Fix double redraw flash on reconnect

- Remove separate force_redraw on WebSocket connect
- Integrate size toggle into set_terminal_size for single redraw
- Update test to expect two executor calls (toggle pattern)
This commit is contained in:
GitHub Copilot
2026-01-24 16:48:53 +00:00
parent 032d46b2a9
commit 3f265f19dc
3 changed files with 8 additions and 6 deletions
+4 -2
View File
@@ -139,13 +139,15 @@ class TerminalSession(Session):
await asyncio.sleep(0.1)
async def set_terminal_size(self, width: int, height: int) -> None:
"""Set terminal size and force a redraw."""
# Track the size for reconnection
self._last_width = width
self._last_height = height
# First resize the PTY (blocking call in executor)
loop = asyncio.get_running_loop()
# Toggle size to force tmux to redraw, then set final size
await loop.run_in_executor(None, self._set_terminal_size, width - 1, height)
await loop.run_in_executor(None, self._set_terminal_size, width, height)
# Then resize pyte screen to match (after PTY resize completes)
# Resize pyte screen to match
async with self._screen_lock:
self._screen.resize(height, width)