Saved cursor position (CSI s) not restored (CSI u) #22629

Open
opened 2026-01-31 08:18:59 +00:00 by claunia · 0 comments
Owner

Originally created by @vefatica on GitHub (Dec 8, 2024).

Windows Terminal version

1.22.2411.18002 (preview)

Windows build number

10.0.19045.5131 (2009, 22H2)

Other Software

Source for stand-alone test attached. No other software needed.

Steps to reproduce

I have a test app (zipped source attached) which temporarily provides line numbers (in WT or a console). It works like this:

Save the rightmost 3 columns of the terminal
Turn off the cursor and save its position (L"\x1b[?25l" L"\x1b[s")
In each row (i), add 3 spaces at the front and write line numbers (wsprintf(szSequence, L"\x1b[%d;1H" L"\x1b[3@" L"\x1b[1G" L"%02d ", i, i);)

Sleep(3000); later ...

In each row (i) , get rid of the line numbers (wsprintf(szSequence, L"\x1b[%d;1H" L"\x1b[3P", i);)
Restore the rightmost 3 columns.
Restore the cursor position and turn it back on

Sleep(3000);

When run in a console, the cursor position has been restored during the second sleep. When run in WT, the cursor has not been restored during the second sleep; it's at the beginning of the last row..

I believe that, a couple years ago, this worked correctly in WT.

linenos.zip

Expected Behavior

Same in WT and console

Actual Behavior

When run in a console, the cursor position has been restored during the second sleep. When run in WT, the cursor has not been restored during the second sleep; it's at the beginning of the last row..

Originally created by @vefatica on GitHub (Dec 8, 2024). ### Windows Terminal version 1.22.2411.18002 (preview) ### Windows build number 10.0.19045.5131 (2009, 22H2) ### Other Software Source for stand-alone test attached. No other software needed. ### Steps to reproduce I have a test app (zipped source attached) which temporarily provides line numbers (in WT or a console). It works like this: Save the rightmost 3 columns of the terminal Turn off the cursor and save its position (L"\x1b[?25l" L"\x1b[s") In each row (i), add 3 spaces at the front and write line numbers (wsprintf(szSequence, L"\x1b[%d;1H" L"\x1b[3@" L"\x1b[1G" L"%02d ", i, i);) Sleep(3000); later ... In each row (i) , get rid of the line numbers (wsprintf(szSequence, L"\x1b[%d;1H" L"\x1b[3P", i);) Restore the rightmost 3 columns. Restore the cursor position and turn it back on Sleep(3000); When run in a console, the cursor position has been restored during the second sleep. When run in WT, the cursor has not been restored during the second sleep; it's at the beginning of the last row.. I believe that, a couple years ago, this worked correctly in WT. [linenos.zip](https://github.com/user-attachments/files/18053165/linenos.zip) ### Expected Behavior Same in WT and console ### Actual Behavior When run in a console, the cursor position has been restored during the second sleep. When run in WT, the cursor has not been restored during the second sleep; it's at the beginning of the last row..
claunia added the Needs-TriageIssue-Bug labels 2026-01-31 08:18:59 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#22629