terminal
terminal copied to clipboard
Bad formatting in Windows after exiting vim over ssh
Windows Terminal version
1.21.10351.0
Windows build number
10.0.19045.0
Other Software
VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Feb 26 2025 16:35:59) Included patches: 1-1151 OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2
Steps to reproduce
- From a linux machine, running gnome-terminal or foot
- ssh to windows 10 machine
- Start vim 9.1
- Exit vim 9.1 with :q!
- Observer vim graphical artifacts still in the bottom of the window
- Resize the window and they go away
Script log: out.log
Expected Behavior
No vim artifacts after exiting.
Actual Behavior
Vim artifacts left after exiting.
We've found some similar issues:
- #13184 , similarity score: 81%
If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.
Note: You can give me feedback by 👍 or 👎 this comment.
Team notes: I directed Daniel here from the vim repo :)
Some notes from my investigation. This problem seems to only occur on windows 10, but not on windows 11. The terminal height must be greater than 46 lines for the problem to occur. Say, the height is 50 lines. the "mode" command shows 50 lines (and sometimes like 9001 lines!?). Then, after vim exits, the terminal application still appears as greater than 46 lines, but the "mode" command now reports only 46 lines. Also, in cases when the cursor was beyond line 46 when vim was started, then after exiting vim the cursor position snaps up to line ~46 when you start typing. I wonder if the virtual pty that is allocated in the sshd session on windows 10 is a bit different than the one in windows 11?
Vim now has a patch to work around this "quirk" for now.
I'll try and provide the simplest C code that demonstrates the discrepency between Windows 10 and 11, that caused this issue.
Vim now has a patch to work around this "quirk" for now.
I'll try and provide the simplest C code that demonstrates the discrepency between Windows 10 and 11, that caused this issue.
Apologies - I really struggled to narrow down a sub-set of which of the various console api interactions caused the problem between vim / windows 10 vs 11 / and inside an ssh session provided by windows ssh. I think I have provided enough steps to replicate it anyway? Let me know if there are any questions - I can try and help with this as best I can. The other point on this, is that it maybe not highly important anymore, since vim is now doing it in such a way to make it work properly on both windows 10 as well as windows 11. I just thought you might be interested to find out what the difference was, in vim's previous behavior, why it was different on windows 10 v 11 (inside the ssh session)