Terminal: add support for showing/hiding the cursor (DECSET/DECRST 25, DECTCEM) #4312

Closed
opened 2026-01-30 23:43:36 +00:00 by claunia · 5 comments
Owner

Originally created by @egmontkob on GitHub (Oct 6, 2019).

Originally assigned to: @zadjii-msft on GitHub.

Environment

Windows build number: Win32NT 10.0.18362.0
Windows Terminal version (if applicable): 0.5.2762.0

Steps to reproduce

printf '\e[?25l'

Expected behavior

The cursor should become invisible.

Actual behavior

The cursor remains visible and blinking. It is often misplaced on subsequent operations, though.

E.g. press the Up arrow, it brings back the previous printf command to the command line. Press the Left arrow, the cursor doesn't move. Press Backspace, the letter l is removed (that is, the logical cursor did indeed move to the left in the previous step), the cursor now blinks at the right edge.

Originally created by @egmontkob on GitHub (Oct 6, 2019). Originally assigned to: @zadjii-msft on GitHub. <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 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: Win32NT 10.0.18362.0 Windows Terminal version (if applicable): 0.5.2762.0 ``` # Steps to reproduce printf '\e[?25l' # Expected behavior The cursor should become invisible. # Actual behavior The cursor remains visible and blinking. It is often misplaced on subsequent operations, though. E.g. press the Up arrow, it brings back the previous printf command to the command line. Press the Left arrow, the cursor doesn't move. Press Backspace, the letter `l` is removed (that is, the logical cursor did indeed move to the left in the previous step), the cursor now blinks at the right edge.
Author
Owner

@DHowett-MSFT commented on GitHub (Oct 6, 2019):

Hey, we actually just got ConPTY support for rendering the cursor's hidden state (#2829). Right now, if conhost thinks the cursor is hidden it's not liable to leave it in the right place... I think we have another bug in here somewhere about the cursor being misplaced when deleting characters (and that's definitely something we shouldn't do :P)

@DHowett-MSFT commented on GitHub (Oct 6, 2019): Hey, we actually just got ConPTY support for rendering the cursor's hidden state (#2829). Right now, if conhost thinks the cursor is hidden it's not liable to leave it in the right place... I think we have another bug in here somewhere about the cursor being misplaced when deleting characters (and that's definitely something we shouldn't do :P)
Author
Owner

@DHowett-MSFT commented on GitHub (Oct 7, 2019):

Tearing off the Triage tag: this is now the master Task for supporting cursor hiding in WT. 😄

(when the cursor is hidden by the application, conhost is a lot more lax in keeping its location in sync with the connected terminal)

@DHowett-MSFT commented on GitHub (Oct 7, 2019): Tearing off the Triage tag: this is now the master Task for supporting cursor hiding in WT. :smile: (when the cursor is hidden by the application, conhost is a lot more lax in keeping its location in sync with the connected terminal)
Author
Owner

@j4james commented on GitHub (Jan 5, 2020):

Note that the escape sequence used by the XtermEngine to hide the cursor is incorrect:

6f667f48ae/src/renderer/vt/XtermEngine.cpp (L106-L112)

The \x1b[25l should be \x1b[?25l.

@j4james commented on GitHub (Jan 5, 2020): Note that the escape sequence used by the `XtermEngine` to hide the cursor is incorrect: https://github.com/microsoft/terminal/blob/6f667f48ae109d4291cda1f8d4e977315c0dae8a/src/renderer/vt/XtermEngine.cpp#L106-L112 The `\x1b[25l` should be `\x1b[?25l`.
Author
Owner

@zadjii-msft commented on GitHub (Jan 6, 2020):

@j4james holy crap that's a good catch

@zadjii-msft commented on GitHub (Jan 6, 2020): @j4james holy crap that's a good catch
Author
Owner

@zadjii-msft commented on GitHub (Mar 12, 2020):

note to self: I'm waiting on #4859 to merge because that PR's got most of the implementation of TerminalDispatch::_PrivateModeParamsHelper (where these sequences would need to be handled), and I don't want to create a massive merge conflict

@zadjii-msft commented on GitHub (Mar 12, 2020): note to self: I'm waiting on #4859 to merge because that PR's got most of the implementation of `TerminalDispatch::_PrivateModeParamsHelper` (where these sequences would need to be handled), and I don't want to create a massive merge conflict
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#4312