terminal lost scrollbar after an unexcepted close of ssh/tmux #19760

Closed
opened 2026-01-31 06:52:49 +00:00 by claunia · 1 comment
Owner

Originally created by @clor09 on GitHub (Apr 24, 2023).

Windows Terminal version

1.16.10262.0

Windows build number

10.0.22621.0

Other Software

OpenSSH_for_Windows_8.6p1, LibreSSL 3.4.3
tmux 3.1c

Steps to reproduce

  1. open a new terminal tab
  2. run some commands(eg. ps) to get long output. the scrollbar appears, and you can see history output just by scroll up
  3. ssh to a remote machine(linux better~)
  4. start tmux on remote machine. do something, like split a pane, run some commands but keep the tmux session open
  5. switch to another tab, in pwsh do kill -name ssh , (make sure this is the ssh process you have made above)
  6. switch back to the previous tab, the ssh process get killed, but the scroll bar does not come back, you can no longer scroll up to see the history. run ps to make a long output, and still, you cant see the full output by scroll up any more

Expected Behavior

if the remote session lost by any means, terminal should recover to a normal status, and the history need to be seen (both before and after the ssh/tmux(crashed or normal quit))

Actual Behavior

output before the ssh/tmux session "lost", after the ssh/tmux session crashed terminal was left in a bad status. long output can no longer be seen by scroll up

Originally created by @clor09 on GitHub (Apr 24, 2023). ### Windows Terminal version 1.16.10262.0 ### Windows build number 10.0.22621.0 ### Other Software OpenSSH_for_Windows_8.6p1, LibreSSL 3.4.3 tmux 3.1c ### Steps to reproduce 1. open a new terminal tab 2. run some commands(eg. ps) to get long output. the scrollbar appears, and you can see history output just by scroll up 3. ssh to a remote machine(linux better~) 4. start tmux on remote machine. do something, like split a pane, run some commands but keep the tmux session open 5. switch to another tab, in pwsh do `kill -name ssh` , (make sure this is the ssh process you have made above) 6. switch back to the previous tab, the ssh process get killed, but the scroll bar does not come back, you can no longer scroll up to see the history. run `ps` to make a long output, and still, you cant see the full output by scroll up any more ### Expected Behavior if the remote session lost by any means, terminal should recover to a normal status, and the history need to be seen (both before and after the ssh/tmux(crashed or normal quit)) ### Actual Behavior output before the ssh/tmux session "lost", after the ssh/tmux session crashed terminal was left in a bad status. long output can no longer be seen by scroll up
claunia added the Issue-QuestionNeeds-TriageResolution-Answered labels 2026-01-31 06:52:49 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Apr 24, 2023):

Unfortunately, this is something that the Terminal can't fix. This is behavior that's pretty well-conserved across different terminal emulators out there. If one application changes the modes of the terminal, and doesn't shut down cleanly (to reset those modes), the terminal has no way of knowing how to reset those modes automatically. In this specific case, tmux entered the "alternate screen buffer", and didn't have the opportunity to switch back out.

Usually, in this state, a reset should bring the terminal back to a working state. I dunno if there's an easy way to do that from CMD or powershell though - that might be a WSL thing.






<idle thought> Maybe we could add an action for manually toggling which buffer is active? Obviously, this would break apps that think they're in the other one, but maybe? Uhg that would require plumbing through to conpty though, that might be impossible.

@zadjii-msft commented on GitHub (Apr 24, 2023): Unfortunately, this is something that the Terminal can't fix. This is behavior that's pretty well-conserved across different terminal emulators out there. If one application changes the modes of the terminal, and doesn't shut down cleanly (to reset those modes), the terminal has no way of knowing how to reset those modes automatically. In this specific case, `tmux` entered the "alternate screen buffer", and didn't have the opportunity to switch back out. Usually, in this state, a `reset` _should_ bring the terminal back to a working state. I dunno if there's an easy way to do that from CMD or powershell though - that might be a WSL thing. <br><br><br><br> \<idle thought> Maybe we could add an action for manually toggling which buffer is active? Obviously, this would break apps that think they're in the other one, but _maybe_? Uhg that would require plumbing through to conpty though, that might be impossible.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#19760