Skip to content

Commit c6d42ed

Browse files
committed
fix: use alternate screen buffer to prevent scrollback in Warp terminal
1 parent ff0e893 commit c6d42ed

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

centml/cli/shell.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,8 @@ async def _interactive_session(ws_url, token):
292292
screen = pyte.Screen(cols, rows)
293293
stream = pyte.Stream(screen)
294294

295-
# Clear local screen before starting.
296-
sys.stdout.buffer.write(b"\033[2J\033[H")
295+
# Switch to alternate screen buffer (disables scrollback) and clear.
296+
sys.stdout.buffer.write(b"\033[?1049h\033[2J\033[H")
297297
sys.stdout.buffer.flush()
298298

299299
headers = {"Authorization": f"Bearer {token}"}
@@ -324,8 +324,8 @@ def _send_resize():
324324
return exit_code
325325
finally:
326326
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
327-
# Restore cursor visibility and attributes.
328-
sys.stdout.buffer.write(b"\033[?25h\033[0m\n")
327+
# Leave alternate screen buffer, restore cursor and attributes.
328+
sys.stdout.buffer.write(b"\033[?1049l\033[?25h\033[0m")
329329
sys.stdout.buffer.flush()
330330

331331

0 commit comments

Comments
 (0)