ANSISYSRC / DECRC reset color attributes #19151

Open
opened 2026-01-31 06:35:14 +00:00 by claunia · 0 comments
Owner

Originally created by @alabuzhev on GitHub (Dec 28, 2022).

Windows Terminal version

WT 1.16.3463.0, OpenConsole 1.16.2212.12003

Windows build number

10.0.19045.2364

Other Software

No response

Steps to reproduce

https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences#simple-cursor-positioning

Sequence Shorthand Behavior
ESC 7 DECSC Save Cursor Position in Memory**
ESC 8 DECSR Restore Cursor Position from Memory**

https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences#cursor-positioning

<html>
Sequence Code Description Behavior
ESC [ s ANSISYSSC Save Cursor – Ansi.sys emulation **With no parameters, performs a save cursor operation like DECSC
ESC [ u ANSISYSRC Restore Cursor – Ansi.sys emulation **With no parameters, performs a restore cursor operation like DECRC

Unpack and run the cmd file in WT and OpenConsole:
test_cusror_position.zip

It sets color attributes and draws a few lines, saving and restoring cursor position along the way.

Expected Behavior

Since DECRC & ANSISYSRC restore cursor position only (according to the documentation above), I expect the color attributes to be applied to all the printed text.

It works as expected in conhost.exe 10.0.19041.1566 that comes with the OS:

image

Actual Behavior

Color attributes are reset.

OpenConsole 1.16.2212.12003:
image

WT 1.16.3463.0:
image

Originally created by @alabuzhev on GitHub (Dec 28, 2022). ### Windows Terminal version WT 1.16.3463.0, OpenConsole 1.16.2212.12003 ### Windows build number 10.0.19045.2364 ### Other Software _No response_ ### Steps to reproduce https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences#simple-cursor-positioning Sequence | Shorthand | Behavior -- | -- | -- ESC 7 | DECSC | Save Cursor Position in Memory** ESC 8 | DECSR | Restore Cursor Position from Memory** https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences#cursor-positioning <html> <body> <!--StartFragment--> Sequence | Code | Description | Behavior -- | -- | -- | -- ESC [ s | ANSISYSSC | Save Cursor – Ansi.sys emulation | **With no parameters, performs a save cursor operation like DECSC ESC [ u | ANSISYSRC | Restore Cursor – Ansi.sys emulation | **With no parameters, performs a restore cursor operation like DECRC Unpack and run the cmd file in WT and OpenConsole: [test_cusror_position.zip](https://github.com/microsoft/terminal/files/10316390/test_cusror_position.zip) It sets color attributes and draws a few lines, saving and restoring cursor position along the way. ### Expected Behavior Since DECRC & ANSISYSRC restore cursor position *only* (according to the documentation above), I expect the color attributes to be applied to *all the printed text*. It works as expected in conhost.exe 10.0.19041.1566 that comes with the OS: ![image](https://user-images.githubusercontent.com/11453922/209871450-eed9b6bd-b854-464b-b6d1-b753fb472f1f.png) ### Actual Behavior Color attributes are reset. OpenConsole 1.16.2212.12003: ![image](https://user-images.githubusercontent.com/11453922/209871612-339ade2d-52f9-4da8-ae08-2f4ac95d4f80.png) WT 1.16.3463.0: ![image](https://user-images.githubusercontent.com/11453922/209871951-04168e52-2155-4ee9-ba0c-ea7976625843.png)
claunia added the Needs-TriageIssue-Bug labels 2026-01-31 06:35:15 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#19151