fix: hide stty resize command from terminal output using ANSI escapes
This commit is contained in:
@@ -155,7 +155,13 @@ class TerminalSession:
|
|||||||
# Docker exec doesn't forward PTY resize to the container process,
|
# Docker exec doesn't forward PTY resize to the container process,
|
||||||
# so we need to explicitly set the size inside the container shell.
|
# so we need to explicitly set the size inside the container shell.
|
||||||
# Send on every resize so the container shell always matches the frontend.
|
# Send on every resize so the container shell always matches the frontend.
|
||||||
stty_cmd = f"stty cols {cols} rows {rows}\n".encode()
|
# Use ANSI escape sequences to hide the command from view:
|
||||||
|
# - \x1b[?25l: hide cursor
|
||||||
|
# - \x1b[A\x1b[2K: move up and clear line
|
||||||
|
# - \x1b[?25h: show cursor
|
||||||
|
stty_cmd = (
|
||||||
|
f"\x1b[?25lstty cols {cols} rows {rows}\n\x1b[A\x1b[2K\x1b[?25h"
|
||||||
|
).encode()
|
||||||
await self.write_input(stty_cmd)
|
await self.write_input(stty_cmd)
|
||||||
logger.debug(f"Sent stty resize to container for session {self.session_id}: {cols}x{rows}")
|
logger.debug(f"Sent stty resize to container for session {self.session_id}: {cols}x{rows}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user