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 can't restore its shape after leaving Vim and WSL #13420

Closed
thezbm opened this issue Jul 2, 2022 · 6 comments
Closed

cursor can't restore its shape after leaving Vim and WSL #13420

thezbm opened this issue Jul 2, 2022 · 6 comments
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting

Comments

@thezbm
Copy link

thezbm commented Jul 2, 2022

Windows Terminal version

1.13.11432.0

Windows build number

10.0.22000.0

Other Software

Ubuntu 22.04 LTS
Neovim v0.7.0

Steps to reproduce

The cursor is currently a blinking bar as I set in the configuration for WT.
Then enter Ubuntu by entering wsl.
Open nvim.
Quit it.
Quit WSL.

bug.mp4

Expected Behavior

The cursor should be stored to a blinking bar immediately after I quit Neovim.

Actual Behavior

The cursor continues to be a white block.
It seems that after Neovim changed the shape of the text input cursor, Windows Terminal didn't change it back.

@thezbm thezbm added the Issue-Bug It either shouldn't be doing this or needs an investigation. label Jul 2, 2022
@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 2, 2022
@j4james
Copy link
Collaborator

j4james commented Jul 2, 2022

I'm afraid this is known issue with neovim (see neovim/neovim#4396), and their recommended workaround is to reset the cursor manually with a VimLeave handler.

See also #9081.

@thezbm
Copy link
Author

thezbm commented Jul 2, 2022

I'm afraid this is known issue with neovim (see neovim/neovim#4396), and their recommended workaround is to reset the cursor manually with a VimLeave handler.

See also #9081.

Oh, I see. Thanks for your time. I managed to fix it with a VimLeave autocmd.
See #4867 for more information.

@thezbm thezbm closed this as completed Jul 2, 2022
@amine-aboufirass
Copy link

@j4james what if I'm using neovim?

@j4james
Copy link
Collaborator

j4james commented Mar 23, 2023

@j4james what if I'm using neovim?

@amine-aboufirass I don't understand what you're asking. The issue I linked above, and the suggested workaround is for neovim.

@amine-aboufirass
Copy link

amine-aboufirass commented Apr 9, 2023

@j4james I see, I misread your comment.

I have tried opening an nvim instance on Windows Terminal (no WSL) and then doing :au VimLeave * set guicursor=a:block-blinkon0. When I :q! out of nvim I unfortunately see the same behavior and the cursor doesn't change back.

@j4james
Copy link
Collaborator

j4james commented Apr 9, 2023

I have tried opening an nvim instance on Windows Terminal (no WSL) and then doing :au VimLeave * set guicursor=a:block-blinkon0.

Note that what you're requesting there is a block cursor that doesn't blink. If that's not the style you want it changed back to, it's obviously not going to work. For example, if you want to change it back to a horizontal bar that does blink, you'd need to do something like this:

:au VimLeave * set guicursor=a:hor1-blinkon1

If you don't want to have to specify the exact cursor type, and just want it changed back to whatever you've configured in the Windows Terminal settings, I don't know of an easy way to do that, but one of the suggestions in the nvim issue tracker was this:

:au VimLeave * set guicursor= | call chansend(v:stderr, "\x1b[ q")

That said, if you're not using the WSL version of nvim, I'm not which of these options will work, if any.

mdsanima added a commit to mdsanima-dev/dotfiles that referenced this issue Jan 14, 2024
The cursor doesn't change back to original style after leaving Vim
on WSL and Windows Terminal.

microsoft/terminal#13420 (comment)
neovim/neovim#4867 (comment)
mdsanima added a commit to mdsanima-dev/dotfiles that referenced this issue Jan 14, 2024
The cursor doesn't change back to original style after leaving Vim
on WSL and Windows Terminal.

microsoft/terminal#13420 (comment)

neovim/neovim#4867 (comment)
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 Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting
Projects
None yet
Development

No branches or pull requests

3 participants