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 doesn't change back to what's specified in the settings.json #9081

Open
rashil2000 opened this issue Feb 9, 2021 · 20 comments
Open
Labels
Area-VT Virtual Terminal sequence support Help Wanted We encourage anyone to jump in on these. Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-3 A description (P3) Product-Terminal The new Windows Terminal. Resolution-External For issues that are outside this codebase Tracking-External This bug isn't resolved, but it's following an external workitem.
Milestone

Comments

@rashil2000
Copy link
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

@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 Feb 9, 2021
@zadjii-msft
Copy link
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...

@zadjii-msft zadjii-msft added Area-VT Virtual Terminal sequence support Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-3 A description (P3) Product-Terminal The new Windows Terminal. labels Feb 9, 2021
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Feb 9, 2021
@zadjii-msft zadjii-msft added this to the Terminal v2.0 milestone Feb 9, 2021
@zadjii-msft zadjii-msft added the Help Wanted We encourage anyone to jump in on these. label Feb 9, 2021
@rashil2000
Copy link
Contributor Author

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

@DHowett
Copy link
Member

DHowett commented Feb 9, 2021

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

@DHowett
Copy link
Member

DHowett commented Feb 9, 2021

(This should be filed upstream on nvim.)

@DHowett DHowett added Resolution-External For issues that are outside this codebase and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Feb 10, 2021
@rashil2000
Copy link
Contributor Author

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

@zadjii-msft zadjii-msft added the Tracking-External This bug isn't resolved, but it's following an external workitem. label Feb 11, 2021
@burhan
Copy link

burhan commented 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).

@ianyepan
Copy link

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

@rashil2000
Copy link
Contributor Author

rashil2000 commented 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.)

@ianyepan
Copy link

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

@rashil2000
Copy link
Contributor Author

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

@ianyepan
Copy link

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

@rashil2000
Copy link
Contributor Author

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
Copy link

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
Copy link

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.

@zadjii-msft zadjii-msft modified the milestones: Terminal v2.0, 22H2 Jan 4, 2022
@Tainted-Fool
Copy link

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
Copy link
Collaborator

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

@jonlandrum
Copy link

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
Copy link

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

@amine-aboufirass
Copy link

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.

@zadjii-msft zadjii-msft modified the milestones: 22H2, Backlog Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-VT Virtual Terminal sequence support Help Wanted We encourage anyone to jump in on these. Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-3 A description (P3) Product-Terminal The new Windows Terminal. Resolution-External For issues that are outside this codebase Tracking-External This bug isn't resolved, but it's following an external workitem.
Projects
None yet
Development

No branches or pull requests