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

Vim cursor skips forward on single-letter replace #10827

Closed
LRitzdorf opened this issue Jul 30, 2021 · 4 comments
Closed

Vim cursor skips forward on single-letter replace #10827

LRitzdorf opened this issue Jul 30, 2021 · 4 comments
Assignees
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Tag-Fix Doesn't match tag requirements Priority-2 A description (P2) Product-Terminal The new Windows Terminal. Resolution-External For issues that are outside this codebase

Comments

@LRitzdorf
Copy link

Windows Terminal version (or Windows build number)

WT v1.9.1942.0; MS Windows v10.0.19043.1110

Other Software

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled May 2 2021 22:02:47)
64-bit console version for Windows, downloaded from https://github.com/vim/vim-win32-installer/releases/tag/v8.2.2825#:~:text=Signed%2064-bit%20installer. Patch version 2825.

Powerline v2.7 (Python3). powerline-status module, installed via pip.
This is not likely to be related to the issue, but I thought I'd include it nonetheless.

Steps to reproduce

  • Open vim. Of the following, set t_EI and either of the t_S* variables:
let &t_EI .= "\<Esc>[1 q"
let &t_SR .= "\<Esc>[3 q"
let &t_SI .= "\<Esc>[5 q"
  • Trigger single-letter replacement mode by pressing r.
  • The cursor jumps forward, by five characters in my case.

Expected Behavior

The cursor should not jump forward when single-letter replacement mode is triggered.

Actual Behavior

The cursor jumps forward, as noted above.

Note that I've tested this same combination of factors in WSL Vim, and the jump does not occur.

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Jul 30, 2021
@zadjii-msft zadjii-msft added Product-Terminal The new Windows Terminal. Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-2 A description (P2) and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Jul 30, 2021
@zadjii-msft
Copy link
Member

zadjii-msft commented Aug 5, 2021

I've tested this same combination of factors in WSL Vim, and the jump does not occur.

Ooooh. That's a good observation. The issue might have a root cause in Win32 Vim's VT parser. @DHowett will take a look.

@zadjii-msft zadjii-msft added the Resolution-External For issues that are outside this codebase label Aug 5, 2021
@DHowett
Copy link
Member

DHowett commented Aug 5, 2021

This is unfortunately a vim issue.

When it is printing the t_SR value to the screen (and t_SI!), it's dumping the escape characters directly to the screen without letting us parse them. Here's what it looks like in the console host:

vim-win32-bad

This likely stems from the fact that vim.exe does not support escape sequences on Windows. When it is connected to Terminal, they accidentally work. This is only an accident -- vim has not put the console in the correct mode to handle this. As a result, though, the cursor virtually moves over to cover the raw sequence (as it should.)

The real bug is unfortunately that Terminal doesn't handle it like Console does.

@DHowett DHowett closed this as completed Aug 5, 2021
@LRitzdorf
Copy link
Author

Rats, that's unfortunate. Thanks for the information, though!

@alexeicolin
Copy link

alexeicolin commented Nov 12, 2022

UPDATE: issue fixed in vim 9.0.

P.S. Related issue of restoring cursor when exiting vim back into PowerShell, solved using this solution: add to PowerShell profile:

function vim {
        & "C:\Program Files (x86)\Vim\vim82\vim.exe" $args && echo "`e[5 q"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Tag-Fix Doesn't match tag requirements Priority-2 A description (P2) Product-Terminal The new Windows Terminal. Resolution-External For issues that are outside this codebase
Projects
None yet
Development

No branches or pull requests

4 participants