Cursor doesn't change back to what's specified in the settings.json #12466

Open
opened 2026-01-31 03:16:29 +00:00 by claunia · 21 comments
Owner

Originally created by @rashil2000 on GitHub (Feb 9, 2021).

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

Originally created by @rashil2000 on GitHub (Feb 9, 2021). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none 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](https://user-images.githubusercontent.com/46838874/107345251-63d8aa00-6ae9-11eb-9b9a-a71fc3d66acd.gif)
Author
Owner

@zadjii-msft commented on GitHub (Feb 9, 2021):

Huh, interesting. I wonder how they're changing the cursor shape. If they're doing it with the legacy APIs, then there's probably no way for them to get it back to a vertical bar. If they're using VT (which they should be), then this should work...

@zadjii-msft commented on GitHub (Feb 9, 2021): Huh, interesting. I wonder how they're changing the cursor shape. If they're doing it with the legacy APIs, then there's probably no way for them to get it back to a vertical bar. If they're using VT (which they should be), then this _should_ work...
Author
Owner

@rashil2000 commented on GitHub (Feb 9, 2021):

I don't know if it helps, but the same thing happens when I use NeoVim on WSL, or even while SSH'ing into a remote Ubuntu server.

@rashil2000 commented on GitHub (Feb 9, 2021): I don't know if it helps, but the same thing happens when I use NeoVim on WSL, or even while SSH'ing into a remote Ubuntu server.
Author
Owner
@zadjii-msft commented on GitHub (Feb 9, 2021): possibly related: * #4106 * #8560 * #1604 * #7382 I guess none are specifically this, but they're all cursor-related
Author
Owner

@DHowett commented on GitHub (Feb 9, 2021):

nvim is not restoring the cursor on exit using DECSCUSR 0.

@DHowett commented on GitHub (Feb 9, 2021): nvim is not restoring the cursor on exit using `DECSCUSR 0`.
Author
Owner

@DHowett commented on GitHub (Feb 9, 2021):

(This should be filed upstream on nvim.)

@DHowett commented on GitHub (Feb 9, 2021): (This should be filed upstream on nvim.)
Author
Owner

@rashil2000 commented on GitHub (Feb 10, 2021):

Looks like they already have that open neovim/neovim#12283 neovim/neovim#6779 neovim/neovim#4396

@rashil2000 commented on GitHub (Feb 10, 2021): Looks like they already have that open neovim/neovim#12283 neovim/neovim#6779 neovim/neovim#4396
Author
Owner

@burhan commented on GitHub (Mar 25, 2021):

No surprise here, but this also affects vim. Is there a fix to restore the setting? I currently just open a new tab (terminal ver. 1.7.572.0).

@burhan commented on GitHub (Mar 25, 2021): No surprise here, but this also affects `vim`. Is there a fix to restore the setting? I currently just open a new tab (terminal ver. `1.7.572.0`).
Author
Owner

@ianyepan commented on GitHub (Apr 14, 2021):

(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.

@ianyepan commented on GitHub (Apr 14, 2021): > (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.
Author
Owner

@rashil2000 commented on GitHub (Apr 14, 2021):

@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.)

@rashil2000 commented on GitHub (Apr 14, 2021): @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.)
Author
Owner

@ianyepan commented on GitHub (Apr 14, 2021):

@rashil2000 I don't think I've confused them. I really meant "terminals / terminal emulators". I tried my experience with the WSL Ubuntu default terminal, or the terminal emulator that comes with Powershell, or the terminal emulator that comes with CMD, all using WSL zsh as the shell to run neovim.

p.s. In other words, I launched Powershell's default terminal and ran the wsl command to switch to using zsh shell, then ran neovim. The cursor problem doesn't exist.

@ianyepan commented on GitHub (Apr 14, 2021): @rashil2000 I don't think I've confused them. I **really** meant "terminals / terminal emulators". I tried my experience with the WSL Ubuntu default terminal, or the terminal emulator that comes with Powershell, or the terminal emulator that comes with CMD, **all using WSL zsh as the shell to run neovim.** p.s. In other words, I launched Powershell's default terminal and ran the `wsl` command to switch to using zsh shell, then ran neovim. The cursor problem doesn't exist.
Author
Owner

@rashil2000 commented on GitHub (Apr 14, 2021):

... the WSL Ubuntu default terminal, or the terminal emulator that comes with Powershell, or the terminal emulator that comes with CMD...

FYI, all these are different shells in the same terminal, called conhost. CMD, PowerShell, WSL don't ship with their own terminal emulators. They use conhost by default.

@rashil2000 commented on GitHub (Apr 14, 2021): > ... the WSL Ubuntu default terminal, or the terminal emulator that comes with Powershell, or the terminal emulator that comes with CMD... FYI, all these are different shells in the same _terminal_, called `conhost`. CMD, PowerShell, WSL don't ship with their own terminal emulators. They use conhost by default.
Author
Owner

@ianyepan commented on GitHub (Apr 14, 2021):

I see. Could I then say that from my experience, "conhost.exe" is not affected by the cursor issue, and only Windows Terminal is?

@ianyepan commented on GitHub (Apr 14, 2021): I see. Could I then say that from my experience, "conhost.exe" is not affected by the cursor issue, and only Windows Terminal is?
Author
Owner

@rashil2000 commented on GitHub (Apr 14, 2021):

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.

@rashil2000 commented on GitHub (Apr 14, 2021): I think the reason conhost is unaffected is different. It is [known](https://github.com/microsoft/terminal/issues/4124) 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.
Author
Owner

@stuckinforloop commented on GitHub (Jun 26, 2021):

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.

@stuckinforloop commented on GitHub (Jun 26, 2021): > I think the reason conhost is unaffected is different. It is [known](https://github.com/microsoft/terminal/issues/4124) 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.
Author
Owner

@bartMarinissen commented on GitHub (Nov 5, 2021):

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.

@bartMarinissen commented on GitHub (Nov 5, 2021): 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.
Author
Owner

@Tainted-Fool commented on GitHub (May 22, 2022):

This cursor bug is still present for me only while using the Windows Terminal(WT). Vim changes the cursor accordingly while using cmd, powershell, and pwsh but not WT. I've deleted vimrc but the bug is still there. It seems like the setting.json file doesn't allow vim to change cursors when you switch modes. Whatever cursor you have set in WT will be the cursor for all vim modes. Does anyone got any suggestions or a work around?

WT-Vim-Bug

@Tainted-Fool commented on GitHub (May 22, 2022): This cursor bug is still present for me only while using the Windows Terminal(WT). Vim changes the cursor accordingly while using cmd, powershell, and pwsh but not WT. I've deleted vimrc but the bug is still there. It seems like the setting.json file doesn't allow vim to change cursors when you switch modes. Whatever cursor you have set in WT will be the cursor for all vim modes. Does anyone got any suggestions or a work around? ![WT-Vim-Bug](https://user-images.githubusercontent.com/19850526/169711998-a648b2e6-5590-4e45-ae62-b117f30c6b13.gif)
Author
Owner

@j4james commented on GitHub (May 22, 2022):

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.

@j4james commented on GitHub (May 22, 2022): > 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.
Author
Owner

@jonlandrum commented on GitHub (Jul 7, 2022):

I can confirm that this is not just a Windows Terminal issue, but is more likely related to Neovim itself. I am using PowerShell 7 from within wezterm, and I have the same issue.

@jonlandrum commented on GitHub (Jul 7, 2022): I can confirm that this is not just a Windows Terminal issue, but is more likely related to Neovim itself. I am using PowerShell 7 from within wezterm, and I have the same issue.
Author
Owner

@cronyakatsuki commented on GitHub (Jan 15, 2023):

This issue also happened to me with programs like newsboat through wsl where the cursor would become invisible.

@cronyakatsuki commented on GitHub (Jan 15, 2023): This issue also happened to me with programs like newsboat through wsl where the cursor would become invisible.
Author
Owner

@awa5114 commented on GitHub (Apr 9, 2023):

I am facing this issue with Windows Terminal. The issue does not occur when using cmd or a regular powershell terminal. So I believe it's more of a Windows Terminal issue than an nvim issue.

@awa5114 commented on GitHub (Apr 9, 2023): I am facing this issue with Windows Terminal. The issue does not occur when using `cmd` or a regular powershell terminal. So I believe it's more of a Windows Terminal issue than an `nvim` issue.
Author
Owner

@guru245 commented on GitHub (May 11, 2025):

I can show you a workaround.

Add this setting to your neovim init.lua.
vim.o.guicursor = ''

Warning

Mind that it is not a double quote, but two single quotes.

@guru245 commented on GitHub (May 11, 2025): I can show you a workaround. Add this setting to your neovim init.lua. `vim.o.guicursor = ''` > [!Warning] > Mind that it is not a double quote, but two single quotes.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#12466