Skip to content

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

@rashil2000

Description

@rashil2000
Contributor

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

Activity

ghost added
Needs-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting
on Feb 9, 2021
ghost added
Needs-Tag-FixDoesn't match tag requirements
on Feb 9, 2021
zadjii-msft

zadjii-msft commented on Feb 9, 2021

@zadjii-msft
Member

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

added
Area-VTVirtual Terminal sequence support
Issue-BugIt either shouldn't be doing this or needs an investigation.
on Feb 9, 2021
ghost removed
Needs-Tag-FixDoesn't match tag requirements
on Feb 9, 2021
added this to the Terminal v2.0 milestone on Feb 9, 2021
rashil2000

rashil2000 commented on Feb 9, 2021

@rashil2000
ContributorAuthor

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.

DHowett

DHowett commented on Feb 9, 2021

@DHowett
Member

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

DHowett

DHowett commented on Feb 9, 2021

@DHowett
Member

(This should be filed upstream on nvim.)

removed
Needs-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting
on Feb 10, 2021

9 remaining items

rashil2000

rashil2000 commented on Apr 14, 2021

@rashil2000
ContributorAuthor

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.

stuckinforloop

stuckinforloop commented on Jun 26, 2021

@stuckinforloop

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.

bartMarinissen

bartMarinissen commented on Nov 5, 2021

@bartMarinissen

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.

modified the milestones: Terminal v2.0, 22H2 on Jan 4, 2022
Tainted-Fool

Tainted-Fool commented on May 22, 2022

@Tainted-Fool

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

j4james

j4james commented on May 22, 2022

@j4james
Collaborator

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.

jonlandrum

jonlandrum commented on Jul 7, 2022

@jonlandrum

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.

cronyakatsuki

cronyakatsuki commented on Jan 15, 2023

@cronyakatsuki

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

awa5114

awa5114 commented on Apr 9, 2023

@awa5114

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.

modified the milestones: 22H2, Backlog on Jul 5, 2023
guru245

guru245 commented on May 11, 2025

@guru245

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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-VTVirtual Terminal sequence supportHelp WantedWe encourage anyone to jump in on these.Issue-BugIt either shouldn't be doing this or needs an investigation.Priority-3A description (P3)Product-TerminalThe new Windows Terminal.Resolution-ExternalFor issues that are outside this codebaseTracking-ExternalThis bug isn't resolved, but it's following an external workitem.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @DHowett@burhan@j4james@bartMarinissen@guru245

        Issue actions

          Cursor doesn't change back to what's specified in the settings.json · Issue #9081 · microsoft/terminal