-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
VT escape sequences can define both background and foreground, or reset them to default colors.
When using 39 or 49 to reset the foreground or background respectively, these two commands reset both at the same time instead.
Setting foreground then resetting background shouldn't reset the foreground as well, and setting background then resetting foreground shouldn't reset the background.
In RS2, setting one using RGB, then reset the other one ends up resetting both. This worked fine (although limited to 16colors mapping) in RS1.
This has been introduced with the support for real 24bit colors (without mapping) and is still present in 15031.
Repro steps:
The following command should display "TestTest" in light blue :
echo -e "\E[38;2;64;128;255mTest\E[49mTest\E[m"
Instead, the second "Test" is shown in default color, but 49 shouldn't reset the color set by 38;2;R;G;B, it should only reset the background color.
Same problem happens to background color if foreground color is reset after :
echo -e "\E[48;2;64;128;255mTest\E[39mTest\E[m"
Again, 39 shouldn't reset the background set by 48:2;R;G;B, it should only reset the foreground color.
This issue breaks any software that controls both foreground and background and uses 39 and 49 to reset either color. It doesn't only break bash in WSL, it also breaks the same VT in PowerShell or any console app as the problem is in the conhost VT parser.