Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cursor position is wrong after exiting vim #16254

Open
tcx4c70 opened this issue Nov 2, 2023 · 4 comments
Open

Cursor position is wrong after exiting vim #16254

tcx4c70 opened this issue Nov 2, 2023 · 4 comments
Labels
Area-Output Related to output processing (inserting text into buffer, retrieving buffer text, etc.) Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-2 A description (P2) Product-Terminal The new Windows Terminal.
Milestone

Comments

@tcx4c70
Copy link

tcx4c70 commented Nov 2, 2023

Windows Terminal version

1.18.2822.0

Windows build number

10.0.22631.0

Other Software

vim 9.0.2081 (installed via scoop)
Power Shell 7.3.9

Steps to reproduce

  1. Make sure your monitor can display >60 lines in Windows Terminal.
  2. Move cursor to the end of the monitor by entering Enter :)
  3. vim -u NONE test.txt to open vim then exit.
Windows.PowerShell.2023-11-02.16-26-08.mp4

It can't be reproduced if I use pwsh7 directly (without Windows Terminal), so maybe it's a problem of Windows Terminal?

Expected Behavior

After exiting vim, the cursor should be at the last line of the monitor.

Actual Behavior

After exiting vim, the cursor is in the middle of the monitor (~60th line). And cls will not clear the bottom half of the monitor.

@tcx4c70 tcx4c70 added Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Nov 2, 2023
@zadjii-msft
Copy link
Member

Just to be sure - is that PowerShell 7? The tab does say "Windows PowerShell", which makes me think that it's powershell 5 (powershell.exe).

I wonder if the PSReadline version has something to do with it? FWIW, I can repro something similar (on 1.20), but slightly different. For me, vim opens only on the top half, then when I exit, everything's still in the right place, but like half the output is cleared

image

image

@tcx4c70
Copy link
Author

tcx4c70 commented Nov 3, 2023

Just to be sure - is that PowerShell 7? The tab does say "Windows PowerShell", which makes me think that it's powershell 5 (powershell.exe).

Yes, it's PowerShell 7. I have changed the command line of "Windows PowerShell" to pwsh7 manually.

@tcx4c70 tcx4c70 changed the title Cusor position is wrong after exiting vim Cursor position is wrong after exiting vim Nov 6, 2023
@carlos-zamora carlos-zamora added Needs-Repro We can't figure out how to make this happen. Please help find a simplified repro. Product-Terminal The new Windows Terminal. Priority-2 A description (P2) and removed Needs-Repro We can't figure out how to make this happen. Please help find a simplified repro. labels Nov 8, 2023
@carlos-zamora carlos-zamora added this to the Backlog milestone Nov 8, 2023
@carlos-zamora carlos-zamora added Area-Output Related to output processing (inserting text into buffer, retrieving buffer text, etc.) Resolution-External For issues that are outside this codebase and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Resolution-External For issues that are outside this codebase labels Nov 8, 2023
@DHowett
Copy link
Member

DHowett commented Nov 8, 2023

We were about to say this was a vim-specific issue, but... it doesn't reproduce in the traditional Windows console host. 🤔

@zadjii-msft
Copy link
Member

See MicrosoftDocs/Console-Docs#302

I can't find any reference to MaxPhysicalWindowSize in the console docs, I may be missing something, but is there a way to set this value?

The initial COORD in CreatePseudoConsole and in ResizePseudoConsole seem to only take X/Y.

Some programs like vim and other use it as upper bound. Upon exit, it restores the terminal modes and size, which results in the wrong one, breaking the terminal.

emph added

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Output Related to output processing (inserting text into buffer, retrieving buffer text, etc.) Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-2 A description (P2) Product-Terminal The new Windows Terminal.
Projects
None yet
Development

No branches or pull requests

4 participants