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

Weird behavior after changing cursor shape in vim #5084

Closed
moetayuko opened this issue Mar 23, 2020 · 2 comments
Closed

Weird behavior after changing cursor shape in vim #5084

moetayuko opened this issue Mar 23, 2020 · 2 comments
Labels
Needs-Tag-Fix Doesn't match tag requirements Resolution-By-Design It's supposed to be this way. Sometimes for compatibility reasons.

Comments

@moetayuko
Copy link

moetayuko commented Mar 23, 2020

Environment

Windows build number: 10.0.18363.0
Windows Terminal version (if applicable): 0.10.761.0

Steps to reproduce

  1. Launch vim from either WSL or SSH of a Linux host
  2. Set cursor shape options: blinking block in normal mode, blinking vertical bar in insert mode
let &t_SI .= "\<Esc>[5 q"
let &t_EI .= "\<Esc>[0 q"

The shape does change as what we expect, but I observed weird behaviors after that.

Expected behavior

  1. When exiting insert mode, i.e. press i then <ESC>, the cursor stays at where it was if I didn't move it.
  2. When exiting insert mode, the cursor shape should change as soon as <ESC> pressed.
  3. Restore the default shape after exiting vim

Actual behavior

  1. Press i then <ESC>, the cursor moves ahead one character.
  2. The shape didn't change until the next blink.
  3. The cursor stays like a block after exiting.
@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 Mar 23, 2020
@j4james
Copy link
Collaborator

j4james commented Mar 23, 2020

  1. You can find an explanation of why the cursor moves backwards on the VIM stack exchange site. This is expected behaviour, and I see the same behaviour in other terminals emulators too.
  2. The delayed shape changing is because an ESC character can also be the start of a character sequence representing another key, so VIM needs to wait and see if there are more characters following before it can be certain you've actually pressed Esc. Again, this is expected behaviour.
  3. DECSCUSR 0 is officially defined as the block cursor so that's why you get a block on exit. Some terminals do interpret that as the user's preferred cursor, though, and it's possible we may support that one day too (see issue Consider supporting [extension to VT,] DECSCUSR "0" to restore cursor to user default to help vim/others #1604)

@DHowett-MSFT
Copy link
Contributor

Thanks for the comprehensive writeup, James. 😄

@DHowett-MSFT DHowett-MSFT added Resolution-By-Design It's supposed to be this way. Sometimes for compatibility reasons. and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Mar 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs-Tag-Fix Doesn't match tag requirements Resolution-By-Design It's supposed to be this way. Sometimes for compatibility reasons.
Projects
None yet
Development

No branches or pull requests

3 participants