microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
94.88k stars 8.22k forks source link

Background color attribute is filled incorrectly when resizing window #17671

Open 2trvl opened 1 month ago

2trvl commented 1 month ago

Windows Terminal version

1.20.11781.0

Windows build number

10.0.19045.4651

Other Software

print("\033[?1049h")
print("\033[31m")
print("test")

Steps to reproduce

Use Virtual Terminal Sequences. Change background, print some text, resize window (rows+1) or maximize window.

Expected Behavior

The following result was obtained using the Windows API:

set_console_text_attribute(hConsoleOutput, WHITE_FORE + RED_BACK + NORMAL_STYLE)

image

Actual Behavior

1 row red, the following ones are already filled in correctly.

image

maximize window.

image

restoring the window and then maximizing it again fixes this error.

image

but it doesn't help for a single row.

image

It is worth summing up. Attributes are filled into new buffer cells correctly when using Windows Console Api. When using virtual codes, the described problem is observed. Also in Windows Console (cmd.exe) any window scaling, in both Windows Api and virtual codes, causes attributes to be filled incorrectly.

image image image

But this is known, and I understand that you are releasing all fixes in Windows Terminal.

2trvl commented 1 month ago

Windows Terminal Canary 1.22.2151.0 Console API Version: OK Virtual codes: all new cells are marked with the background attribute set.

image image

However, now if you reset the background attribute to the default state, the problem is not observed. In version 1.20.11781.0, even after resetting the attribute, a single red row appears.

image