Hidden cursor becomes visible on resize #16253

Closed
opened 2026-01-31 05:01:48 +00:00 by claunia · 3 comments
Owner

Originally created by @j4james on GitHub (Dec 23, 2021).

Windows Terminal version

n/a

Windows build number

10.0.19041.1348

Other Software

No response

Steps to reproduce

  1. Open a WSL bash shell in conhost.
  2. Hide the cursor with printf "\e[?25l"
  3. Resize the window.

Expected Behavior

The cursor should remain hidden.

Actual Behavior

The cursor becomes visible after the window is resized.

The source of the problem is the SCREEN_INFORMATION::_AdjustScreenBuffer method, where the cursor is temporarily hidden while the buffer is resizing. The problem is that it doesn't check whether the cursor was already hidden to start with, so it mistakenly sets it visible when the resize is finished.

bb71179a24/src/host/screenInfo.cpp (L1023-L1031)

Originally created by @j4james on GitHub (Dec 23, 2021). ### Windows Terminal version n/a ### Windows build number 10.0.19041.1348 ### Other Software _No response_ ### Steps to reproduce 1. Open a WSL bash shell in conhost. 2. Hide the cursor with `printf "\e[?25l"` 3. Resize the window. ### Expected Behavior The cursor should remain hidden. ### Actual Behavior The cursor becomes visible after the window is resized. The source of the problem is the `SCREEN_INFORMATION::_AdjustScreenBuffer` method, where the cursor is temporarily hidden while the buffer is resizing. The problem is that it doesn't check whether the cursor was already hidden to start with, so it mistakenly sets it visible when the resize is finished. https://github.com/microsoft/terminal/blob/bb71179a24ff186eab999676732afff8a345cc12/src/host/screenInfo.cpp#L1023-L1031
Author
Owner

@DHowett commented on GitHub (Dec 24, 2021):

Great catch! Sorry, may take a bit to get to your PR :)

@DHowett commented on GitHub (Dec 24, 2021): Great catch! Sorry, may take a bit to get to your PR :)
Author
Owner

@elsaco commented on GitHub (Dec 24, 2021):

@j4james after hiding the cursor, resizing vertically only (grab top or bottom edge) keeps the cursor hidden. Horizontal resize unhides the cursor. Any pointers on why the vertical resize keeps the cursor hidden? Thx!

@elsaco commented on GitHub (Dec 24, 2021): @j4james after hiding the cursor, resizing vertically only (grab top or bottom edge) keeps the cursor hidden. Horizontal resize unhides the cursor. Any pointers on why the vertical resize keeps the cursor hidden? Thx!
Author
Owner

@j4james commented on GitHub (Dec 27, 2021):

@elsaco I didn't notice that, but that does make sense. Resizing the window vertically wouldn't usually lead to the buffer being resized (unless the buffer was the exact height of the window). And if the buffer isn't being resized, then this code path is skipped. The test is a few lines up from the initial code I quoted:

bb71179a24/src/host/screenInfo.cpp (L1014-L1016)

@j4james commented on GitHub (Dec 27, 2021): @elsaco I didn't notice that, but that does make sense. Resizing the window vertically wouldn't usually lead to the buffer being resized (unless the buffer was the exact height of the window). And if the buffer isn't being resized, then this code path is skipped. The test is a few lines up from the initial code I quoted: https://github.com/microsoft/terminal/blob/bb71179a24ff186eab999676732afff8a345cc12/src/host/screenInfo.cpp#L1014-L1016
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#16253