Blinking cursor shows up in TUI programs (where it shouldn't) in 1.13 #16678

Closed
opened 2026-01-31 05:19:23 +00:00 by claunia · 12 comments
Owner

Originally created by @rashil2000 on GitHub (Feb 6, 2022).

Originally assigned to: @lhecker on GitHub.

Windows Terminal version

1.13.10336.0

Windows build number

10.0.19044.1348

Other Software

scoop install vifm

and

scoop install ncspot

Steps to reproduce

Just launch the programs. See below.

cursor

cursor1c

Expected Behavior

The cursor wasn't showing up (at all) in 1.12 Preview. It shouldn't appear.

Actual Behavior

The cursor appears.

Possibly related - https://github.com/microsoft/terminal/issues/12372 ?

Originally created by @rashil2000 on GitHub (Feb 6, 2022). Originally assigned to: @lhecker on GitHub. ### Windows Terminal version 1.13.10336.0 ### Windows build number 10.0.19044.1348 ### Other Software scoop install [vifm](https://vifm.info) _and_ scoop install [ncspot](https://github.com/hrkfdn/ncspot) ### Steps to reproduce Just launch the programs. See below. ![cursor](https://user-images.githubusercontent.com/46838874/152695110-7285ba2e-22dc-401b-a74d-5bd7a5553780.gif) ![cursor1c](https://user-images.githubusercontent.com/46838874/152696172-6c523a5d-3249-411e-81cf-0fdd34dfccce.gif) ### Expected Behavior The cursor wasn't showing up (at all) in 1.12 Preview. It shouldn't appear. ### Actual Behavior The cursor appears. Possibly related - https://github.com/microsoft/terminal/issues/12372 ?
Author
Owner

@lhecker commented on GitHub (Feb 6, 2022):

Can someone else reproduce this issue? I can't replicate it with vifm 0.12. (ncspot requires a spotify account.)
Neither rendering engine reproduces the issue for me.
Maybe this issue is specific to Windows 10? That seems a bit unlikely though...

@lhecker commented on GitHub (Feb 6, 2022): Can someone else reproduce this issue? I can't replicate it with vifm 0.12. (ncspot requires a spotify account.) Neither rendering engine reproduces the issue for me. Maybe this issue is specific to Windows 10? That seems a bit unlikely though...
Author
Owner

@rashil2000 commented on GitHub (Feb 6, 2022):

I should mention that I manually set TERM to xterm-256color (Neovim needs it to display titles). It was set with 1.12 too.

(I can provide more details about my environment if required).

@rashil2000 commented on GitHub (Feb 6, 2022): I should mention that I manually set TERM to xterm-256color (Neovim needs it to display titles). It was set with 1.12 too. (I can provide more details about my environment if required).
Author
Owner

@elsaco commented on GitHub (Feb 6, 2022):

Demo on Windows 20H2 (10.0.19044.1466) and vifm with no customization:

https://user-images.githubusercontent.com/3933920/152703172-04e7f33f-0f47-4117-a14e-233866fc6209.mp4

@rashil2000 seems to be using a custom theme with starship prompt (judging by the look of it) that might affect his setup.

@elsaco commented on GitHub (Feb 6, 2022): Demo on Windows 20H2 (10.0.19044.1466) and `vifm` with no customization: https://user-images.githubusercontent.com/3933920/152703172-04e7f33f-0f47-4117-a14e-233866fc6209.mp4 @rashil2000 seems to be using a custom theme with `starship` prompt (judging by the look of it) that might affect his setup.
Author
Owner

@rashil2000 commented on GitHub (Feb 7, 2022):

I don't think it has anything to do with Starship. My settings.json profile (here) launches Vifm/Ncspot directly, so it doesn't go through any shell. Nevertheless, I disabled Starship completely to test it, and issue still persists.

@rashil2000 commented on GitHub (Feb 7, 2022): I don't think it has anything to do with Starship. My settings.json profile ([here](https://github.com/rashil2000/dotfiles/blob/master/wt/settings.json)) launches Vifm/Ncspot directly, so it doesn't go through any shell. Nevertheless, I disabled Starship completely to test it, and issue still persists.
Author
Owner

@rashil2000 commented on GitHub (Feb 7, 2022):

Here's 1.13 and 1.12 running side-by-side:

image

@rashil2000 commented on GitHub (Feb 7, 2022): Here's 1.13 and 1.12 running side-by-side: ![image](https://user-images.githubusercontent.com/46838874/152721027-f4ccbc05-cb7c-4807-ac62-57424f768cc8.png)
Author
Owner

@rashil2000 commented on GitHub (Feb 7, 2022):

My vifmrc is here

@rashil2000 commented on GitHub (Feb 7, 2022): My vifmrc is [here](https://github.com/rashil2000/dotfiles/blob/master/vifm/vifmrc)
Author
Owner

@lhecker commented on GitHub (Feb 7, 2022):

I figured it out. Here's how to reproduce the issue:

This issue doesn't occur when:

  • Launched in Windows Terminal 1.12, or...
  • Launched from cmd.exe or PowerShell
@lhecker commented on GitHub (Feb 7, 2022): I figured it out. Here's how to reproduce the issue: * Download vifm: https://github.com/vifm/vifm/releases/download/v0.12/vifm-w64-se-0.12-binary.zip * Create a file named `vifmrc` inside the directory where `vifm.exe` is * Add a single line: `highlight clear` * Create a profile, which has `vifm.exe` as the command line This issue doesn't occur when: * Launched in Windows Terminal 1.12, or... * Launched from cmd.exe or PowerShell
Author
Owner

@rashil2000 commented on GitHub (Feb 7, 2022):

Launched from cmd.exe or PowerShell

Wow, you're right. I didn't test it from Cmd or PowerShell. Even Ncspot does not display the cursor when launched from the shell.

@rashil2000 commented on GitHub (Feb 7, 2022): > Launched from cmd.exe or PowerShell Wow, you're right. I didn't test it from Cmd or PowerShell. Even Ncspot does not display the cursor when launched from the shell.
Author
Owner

@j4james commented on GitHub (Feb 7, 2022):

I think I might know what the problem is here.

There are two variables in the XtermEngine that track the cursor visibility for conpty: _lastCursorIsVisible indicates the last state of the cursor; and _nextCursorIsVisible indicates the state for the current frame. At the end of the frame, if there is a difference between _lastCursorIsVisible and _nextCursorIsVisible, we know we need to send a sequence either to show or hide the cursor.

The problem is that _lastCursorIsVisible is initialized as false, so if the cursor is hidden before the first frame is rendered, then we'll reach the end of the frame with both _lastCursorIsVisible and _nextCursorIsVisible as false. And that makes us think there is no need to send a hide cursor sequence, because we think the cursor is already hidden. This can easily be fixed by initializing _lastCursorIsVisible to true.

What I don't understand, is why this would ever have worked. Unless it's a matter of timing, and in previous versions at least one frame would have been painted before the application had a chance to hide the cursor.

The other concern is that maybe _lastCursorIsVisible was intentionally set to false to guarantee that we send at least one show cursor sequence on startup, in case the client terminal started with a hidden cursor? If that's the case then the _lastCursorIsVisible variable may need a third "unknown" state to start with.

@j4james commented on GitHub (Feb 7, 2022): I think I might know what the problem is here. There are two variables in the XtermEngine that track the cursor visibility for conpty: `_lastCursorIsVisible` indicates the last state of the cursor; and `_nextCursorIsVisible` indicates the state for the current frame. At the end of the frame, if there is a difference between `_lastCursorIsVisible` and `_nextCursorIsVisible`, we know we need to send a sequence either to show or hide the cursor. The problem is that `_lastCursorIsVisible` is initialized as false, so if the cursor is hidden before the first frame is rendered, then we'll reach the end of the frame with both `_lastCursorIsVisible` and `_nextCursorIsVisible` as false. And that makes us think there is no need to send a _hide cursor_ sequence, because we think the cursor is already hidden. This can easily be fixed by initializing `_lastCursorIsVisible` to true. What I don't understand, is why this would ever have worked. Unless it's a matter of timing, and in previous versions at least one frame would have been painted *before* the application had a chance to hide the cursor. The other concern is that maybe `_lastCursorIsVisible` was intentionally set to false to guarantee that we send at least one _show cursor_ sequence on startup, in case the client terminal started with a hidden cursor? If that's the case then the `_lastCursorIsVisible` variable may need a third "unknown" state to start with.
Author
Owner

@lhecker commented on GitHub (Feb 8, 2022):

@j4james You know what's funny? I was about to fix this issue and couldn't for my life replicate it anymore. Only 1 out of maybe 30 tabs of vifm show the cursor issue for me now - it's entirely random, proving that you're right. It's interesting this ever worked.

@lhecker commented on GitHub (Feb 8, 2022): @j4james You know what's funny? I was about to fix this issue and couldn't for my life replicate it anymore. Only 1 out of maybe 30 tabs of vifm show the cursor issue for me now - it's entirely random, proving that you're right. It's interesting this ever worked.
Author
Owner

@j4james commented on GitHub (Feb 8, 2022):

FYI, I found that some of the time it might look like it was working at first - i.e. the cursor appeared to be hidden - but that was just because it was positioned off screen. The minute you did something that updated the status bar, it would end up moving the cursor somewhere that would make it visible.

@j4james commented on GitHub (Feb 8, 2022): FYI, I found that some of the time it might look like it was working at first - i.e. the cursor appeared to be hidden - but that was just because it was positioned off screen. The minute you did something that updated the status bar, it would end up moving the cursor somewhere that would make it visible.
Author
Owner

@ghost commented on GitHub (Feb 11, 2022):

:tada:This issue was addressed in #12434, which has now been successfully released as Windows Terminal Preview v1.13.10395.0.🎉

Handy links:

@ghost commented on GitHub (Feb 11, 2022): :tada:This issue was addressed in #12434, which has now been successfully released as `Windows Terminal Preview v1.13.10395.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.13.10395.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#16678