terminal: Cursor doesn't change back to what's specified in the settings.json

Environment

Windows build number: 10.0.19042.746
Windows Terminal version (if applicable): 1.6.10272.0

Any other software?
NeoVim: 0.4.4

Steps to reproduce

Set your cursor to ‘bar’ style. Open WT. Run nvim. The cursor inside neovim is a block cursor. Exit neovim now.

Expected behavior

The cursor should turn back to bar style.

Actual behavior

The cursor remains in block style.

hmm3

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 9
  • Comments: 20 (9 by maintainers)

Most upvoted comments

I think the reason conhost is unaffected is different. It is known to reset cursor shapes on its own. I’m not aware if it’s been fully fixed yet.

In my experience though, all the other terminals I mentioned in my previous comment suffer from this issue, so I’m kinda certain it’s not just Windows Terminal; it has something to do with Neovim itself.

No its not. This issue is only faced when exiting NeoVim on Windows Terminal. I have tried to do so in Alacritty and everything is working fine on Alacritty.

I think the reason conhost is unaffected is different. It is known to reset cursor shapes on its own. I’m not aware if it’s been fully fixed yet.

In my experience though, all the other terminals I mentioned in my previous comment suffer from this issue, so I’m kinda certain it’s not just Windows Terminal; it has something to do with Neovim itself.

@ianpan870102 I think you’re confusing a terminal with a shell. The Neovim bug exists on all terminals (mintty, alacritty, xfce4-terminal, conhost, Windows Terminal, ConEmu etc.). It’s independent of any shell (PowerShell, CMD, Cygwin-Bash, WSL etc.)

(This should be filed upstream on nvim.)

I’m having the same issue with the cursor and I was wondering if the problem lies with neovim or Windows Terminal. After some experiments, I noticed that when using any other terminal emulator (for instance, the WSL Ubuntu default terminal, or the powershell emulator, or even CMD), the problem with cursor on neovim exit does not exist.

I’m afraid Windows Terminal is the only emulator I see that has this problem.

Vim changes the cursor accordingly while using cmd, powershell, and pwsh but not WT.

@Tainted-Fool What you’re describing is a different issue. The Windows version of vim is probably using the SetConsoleCursorInfo API to alter the cursor size, but there’s no equivalent VT sequence for that, so it can’t be forwarded over the conpty connection to Windows Terminal. That problem is being tracked in issue #7382.

I am also suffering from this problem.

It is unique to using nvim in a Windows terminal. Using the old style terminal properly restores the cursor.

When using normal vim in a windows terminal, I can get the problem fixed by adding the line: autocmd VimLeave * silent !echo -ne "\e[0 q" to my .vimrc. The same line in my nvim init.vim file does not work.