Incorrect background color when scrolling up #185

Closed
opened 2026-01-30 21:44:55 +00:00 by claunia · 2 comments
Owner

Originally created by @j4james on GitHub (Mar 8, 2018).

Originally assigned to: @zadjii-msft on GitHub.

Windows build number: [Version 10.0.16299.248]

If I use an ANSI sequence to set the background color attribute, then move to the bottom of the screen and output some newlines so the screen scrolls up, I'd expect the newly revealed lines to have the background color that I just set.

Similarly, if I move to the top of the screen, and output the reverse feed sequence (\033M) so the screen scrolls down, I'd again expect the new revealed lines to use the current background color.

The later case (scrolling down) works as expected, but scrolling up does not.

Test case (from a bash shell):
printf "\033[44m\033[200B\n\n\033[200A\033M\033[m"

I'd expect the above sequence to result in both the top and bottom lines of the screen having a blue background (which is what I see in a Linux console), but in the Windows 10 console, only the top line is blue.

Note that the scroll up sequence (\033[S) has similar problems, although it's a little more complicated. The first line that's revealed when scrolling up will have the wrong background color, but subsequent lines will be correct. Scrolling down (like reverse feed) always seems to work as expected.

I suspect this may be related to issue #70. I apologise if it's just a duplicate.

Originally created by @j4james on GitHub (Mar 8, 2018). Originally assigned to: @zadjii-msft on GitHub. **Windows build number:** [Version 10.0.16299.248] If I use an ANSI sequence to set the background color attribute, then move to the bottom of the screen and output some newlines so the screen scrolls up, I'd expect the newly revealed lines to have the background color that I just set. Similarly, if I move to the top of the screen, and output the reverse feed sequence (`\033M`) so the screen scrolls down, I'd again expect the new revealed lines to use the current background color. The later case (scrolling down) works as expected, but scrolling up does not. **Test case (from a bash shell):** `printf "\033[44m\033[200B\n\n\033[200A\033M\033[m"` I'd expect the above sequence to result in both the top and bottom lines of the screen having a blue background (which is what I see in a Linux console), but in the Windows 10 console, only the top line is blue. Note that the scroll up sequence (`\033[S`) has similar problems, although it's a little more complicated. The first line that's revealed when scrolling up will have the wrong background color, but subsequent lines will be correct. Scrolling down (like reverse feed) always seems to work as expected. I suspect this may be related to issue #70. I apologise if it's just a duplicate.
claunia added the Product-ConhostWork-Item labels 2026-01-30 21:44:55 +00:00
Author
Owner

@bitcrazed commented on GitHub (May 4, 2018):

Thanks for filing. I can confirm that Console with Ubuntu/WSL does this:
image

Whereas an Ubuntu VM does this:
image

@bitcrazed commented on GitHub (May 4, 2018): Thanks for filing. I can confirm that Console with Ubuntu/WSL does this: ![image](https://user-images.githubusercontent.com/961950/39609818-90513636-4f00-11e8-86ba-ddfea65ebc53.png) Whereas an Ubuntu VM does this: ![image](https://user-images.githubusercontent.com/961950/39609833-b387e2f8-4f00-11e8-8c43-84fd8253fc9a.png)
Author
Owner

@zadjii-msft commented on GitHub (Jun 8, 2018):

I love when bug reports have a nice simple string of VT sequences like this. Makes it really easy to debug and find solutions.

Submitting the PR now, shouldn't be too hard to get through code review.

@zadjii-msft commented on GitHub (Jun 8, 2018): I love when bug reports have a nice simple string of VT sequences like this. Makes it really easy to debug and find solutions. Submitting the PR now, shouldn't be too hard to get through code review.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#185