Popup windows can cause weird color updates in conhost #8658

Closed
opened 2026-01-31 01:34:48 +00:00 by claunia · 2 comments
Owner

Originally created by @j4james on GitHub (May 29, 2020).

Environment

Windows build number: Version 10.0.18362.720

Steps to reproduce

  1. Open a conhost cmd shell.
  2. Open the Properties dialog and make sure Terminal Colors are unchecked, and the Screen Background is set to black (index 0). Restart the shell if you had to change the colors.
  3. Do something in the shell to fill the screen with text, e.g. dir /?.
  4. Press F7 to popup the command history window.
  5. While the popup is still visible, open the Properties dialog again, and change the Screen Background to blue (index 1).
  6. After saving the properties, press Esc to close the history popup.

Expected behavior

The text beneath the popup should be restored with its original color, or otherwise the entire screen background should have changed to blue.

Actual behavior

Most of the screen remains black, but the lines beneath the popup have changed to blue.

image

What's happening is that the Popup class is trying to be clever, and update the area beneath it to match the changes to the default colors, assuming the rest of the screen is also going to be changed (which is what used to happen in the v1 console). But since that's no longer the case, it's actually just breaking things.

You could argue that we should be fixing the fact that the default screen colors don't update. But the best way to do that (at least in my opinion), is the solution I proposed for #5952. With that fix in place, the default colors just update automatically, so there should be no need for the popup window to perform any additional color mapping.

And in addition to updating the default colors, it also tries to update what it thinks are popup colors (or their inverse). So any text that just happens to match those colors can find itself being updated as well. I assume this is to handle the case of a popup on top of another popup, but the popup window itself doesn't update when you change those colors, so I can't see why it would need to update another popup beneath it.

In short, I would like to propose we get rid of this code altogether, unless someone knows of a genuine need for it. Right now it seems to be doing more harm than good.

Originally created by @j4james on GitHub (May 29, 2020). # Environment Windows build number: Version 10.0.18362.720 # Steps to reproduce 1. Open a conhost cmd shell. 2. Open the _Properties_ dialog and make sure _Terminal Colors_ are unchecked, and the _Screen Background_ is set to black (index 0). Restart the shell if you had to change the colors. 3. Do something in the shell to fill the screen with text, e.g. `dir /?`. 4. Press <kbd>F7</kbd> to popup the command history window. 5. While the popup is still visible, open the _Properties_ dialog again, and change the _Screen Background_ to blue (index 1). 6. After saving the properties, press <kbd>Esc</kbd> to close the history popup. # Expected behavior The text beneath the popup should be restored with its original color, or otherwise the entire screen background should have changed to blue. # Actual behavior Most of the screen remains black, but the lines beneath the popup have changed to blue. ![image](https://user-images.githubusercontent.com/4181424/83203157-b8e1b500-a140-11ea-8199-e34c3c6b1868.png) What's happening is that the `Popup` class is trying to be clever, and update the area beneath it to match the changes to the default colors, assuming the rest of the screen is also going to be changed (which is what used to happen in the v1 console). But since that's no longer the case, it's actually just breaking things. You could argue that we should be fixing the fact that the default screen colors don't update. But the best way to do that (at least in my opinion), is the solution I proposed for #5952. With that fix in place, the default colors just update automatically, so there should be no need for the popup window to perform any additional color mapping. And in addition to updating the default colors, it also tries to update what it thinks are popup colors (or their inverse). So any text that just happens to match those colors can find itself being updated as well. I assume this is to handle the case of a popup on top of another popup, but the popup window itself doesn't update when you change those colors, so I can't see why it would need to update another popup _beneath_ it. In short, I would like to propose we get rid of this code altogether, unless someone knows of a genuine need for it. Right now it seems to be doing more harm than good.
Author
Owner

@zadjii-msft commented on GitHub (Jun 1, 2020):

Yep that looks like a real bug to me. Thanks for the investigation so far!

@zadjii-msft commented on GitHub (Jun 1, 2020): Yep that looks like a real bug to me. Thanks for the investigation so far!
Author
Owner

@ghost commented on GitHub (Jun 18, 2020):

:tada:This issue was addressed in #6358, which has now been successfully released as Windows Terminal Preview v1.1.1671.0.🎉

Handy links:

@ghost commented on GitHub (Jun 18, 2020): :tada:This issue was addressed in #6358, which has now been successfully released as `Windows Terminal Preview v1.1.1671.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.1.1671.0) * [Store Download](https://www.microsoft.com/store/apps/9n0dx20hk701?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#8658