SGR foreground color is not properly reset after the scrollbar appears #17738

Closed
opened 2026-01-31 05:51:53 +00:00 by claunia · 2 comments
Owner

Originally created by @wangdongustc on GitHub (Jun 18, 2022).

Windows Terminal version

1.13.11432.0

Windows build number

10.0.22000.0

Other Software

The Example of SGR terminal sequences in the Windows Console documentation.

Steps to reproduce

  1. Compile the example source code (I used CMake, Ninja, and MSVC 19.32.31329.0, should not matter).
  2. Run the program in Windows Terminal, again and again, until the scrollbar appears.

Expected Behavior

Consistent output as in the Windows Console documentation.

image

Actual Behavior

The SGR foreground color is not properly reset after the scrollbar appears. The output is inconsistent.

image

Originally created by @wangdongustc on GitHub (Jun 18, 2022). ### Windows Terminal version 1.13.11432.0 ### Windows build number 10.0.22000.0 ### Other Software The [Example of SGR terminal sequences](https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences#example-of-sgr-terminal-sequences) in the Windows Console documentation. ### Steps to reproduce 1. Compile the example source code (I used CMake, Ninja, and MSVC 19.32.31329.0, should not matter). 2. Run the program in Windows Terminal, again and again, until the scrollbar appears. ### Expected Behavior Consistent output as in the Windows Console documentation. ![image](https://user-images.githubusercontent.com/3369452/174431175-5fc2f372-31b8-41e3-a327-78535e4f3a41.png) ### Actual Behavior The SGR foreground color is not properly reset after the scrollbar appears. The output is inconsistent. ![image](https://user-images.githubusercontent.com/3369452/174431436-b75385fb-ac1e-4dbb-b717-928a2fa7890d.png)
claunia added the Needs-TriageIssue-BugNeeds-Tag-Fix labels 2026-01-31 05:51:53 +00:00
Author
Owner

@j4james commented on GitHub (Jun 18, 2022):

This is by design. When the viewport scrolls, the newly revealed lines are filled with the active background color. So when you've got the background set to blue, and the viewport scrolls, the line that follows is going to start off filled with blue. Same thing happens with the area in white. You'll find that most modern terminals work the same way.

@j4james commented on GitHub (Jun 18, 2022): This is by design. When the viewport scrolls, the newly revealed lines are filled with the active background color. So when you've got the background set to blue, and the viewport scrolls, the line that follows is going to start off filled with blue. Same thing happens with the area in white. You'll find that most modern terminals work the same way.
Author
Owner

@wangdongustc commented on GitHub (Jun 19, 2022):

This is by design. When the viewport scrolls, the newly revealed lines are filled with the active background color. So when you've got the background set to blue, and the viewport scrolls, the line that follows is going to start off filled with blue. Same thing happens with the area in white. You'll find that most modern terminals work the same way.

Thanks for the explanation. Good to know! I tested on Gnome Terminal and yes the results are the same.

@wangdongustc commented on GitHub (Jun 19, 2022): > This is by design. When the viewport scrolls, the newly revealed lines are filled with the active background color. So when you've got the background set to blue, and the viewport scrolls, the line that follows is going to start off filled with blue. Same thing happens with the area in white. You'll find that most modern terminals work the same way. Thanks for the explanation. Good to know! I tested on Gnome Terminal and yes the results are the same.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#17738