You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Reset terminal state leaves the alternate screen while the program is still running #347
Reset terminal state (Ctrl+Shift+R, or the command palette) calls resetTerminalModes. When the pane is on the alternate buffer, terminalResetSequence(true) starts with ESC[?1049l, which switches xterm back to the normal buffer.
That is right for the case the command was written for (#175): the program that entered the alternate screen has died, and the pane is stuck in its modes. But the wmux:reset-terminal handler in useTerminal.ts runs whenever the PTY is present, including while the program is still running. A running fullscreen program (Claude Code, opencode, vim) never re-sends ESC[?1049h, because from its side nothing happened. The result is the same as #345:
the program's next frames are drawn into the normal buffer and its scrollback
a full-screen clear from the program wipes the shell's own lines
when the program exits, its ESC[?1049l has no alternate screen to leave and only restores the cursor, so the shell prompt is printed over the stale frame
The resetTerminalModes doc comment expects a live program to put back the modes it wants ("reset while vim is up and vim repaints"). That holds for modes a program re-asserts on every redraw. It doesn't hold for the alternate screen.
Steps to reproduce
I found this by reading the code and haven't reproduced it in the app. Expected reproduction:
Expected bug: ALT-AFTER-1..5 land on the normal screen, and on exit EXITED and the prompt are printed at the top over the old content.
Possible fixes
Leave the alternate buffer only when the program is gone: keep ESC[?1049l on the process-exit path and drop it from the manual reset. A pane whose program is still running stays on the screen that program is drawing.
Or decide per pane with the shell state wmux already tracks (OSC 133). Leave the alternate buffer when the shell is back at its prompt, and keep it while a command is running.
wmux version
2.39.0
Anything else
Related: #175 (where the reset was added) and #345 (same end state, reached through a remount).
Activity
amirlehmam commentedon Oct 24, 2026
Shipped in v2.40.0. Thanks for the detailed report!
fix(terminal): ignore key auto-repeat for Reset terminal state
fix(terminal): let Ctrl+Shift+R leave a dead program's alternate scre…
fix(terminal): keep the alternate screen on a manual reset while its …