Skip to content

Commit ff0e893

Browse files
committed
fix: swap rows/cols unpacking from shutil.get_terminal_size
shutil.get_terminal_size() returns (columns, lines), not (rows, cols). The swapped unpacking caused pyte Screen to be created with terminal line count as width, making the display extremely narrow.
1 parent 559460f commit ff0e893

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

centml/cli/shell.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ async def _interactive_session(ws_url, token):
287287
old_settings = termios.tcgetattr(fd)
288288
try:
289289
tty.setraw(fd)
290-
rows, cols = shutil.get_terminal_size()
290+
cols, rows = shutil.get_terminal_size()
291291

292292
screen = pyte.Screen(cols, rows)
293293
stream = pyte.Stream(screen)
@@ -307,7 +307,7 @@ async def _interactive_session(ws_url, token):
307307
loop = asyncio.get_running_loop()
308308

309309
def _send_resize():
310-
r, c = shutil.get_terminal_size()
310+
c, r = shutil.get_terminal_size()
311311
screen.resize(r, c)
312312
screen.dirty.update(range(r))
313313
asyncio.ensure_future(
@@ -351,7 +351,7 @@ async def _exec_session(ws_url, token, command):
351351
Does not enter raw mode -- output is pipe-friendly.
352352
Suppresses shell echo and uses markers to capture only command output.
353353
"""
354-
rows, cols = shutil.get_terminal_size(fallback=(80, 24))
354+
cols, rows = shutil.get_terminal_size(fallback=(80, 24))
355355
headers = {"Authorization": f"Bearer {token}"}
356356

357357
async with websockets.connect(

0 commit comments

Comments
 (0)