sublimehq / sublime_text

Issue tracker for Sublime Text
https://www.sublimetext.com
803 stars 39 forks source link

[Themes] text_line_control color_scheme_tint caching issues #6463

Open jwortmann opened 3 weeks ago

jwortmann commented 3 weeks ago

Description of the bug

The color_scheme_tint property for text_line_control in the command palette is not always applied correctly for a certain combination of theme rules.

This bug was reported earlier for the find panel in #3901 and reported to be fixed, but it seems like the fix does not apply in all situations.

Steps to reproduce

  1. Start ST in safe mode.

  2. Select "UI: Customize Theme" from the command palette and paste

    {
        "rules":
        [
            {
                "class": "text_line_control",
                "color_scheme_tint": "black"
            },
            {
                "class": "text_line_control",
                "parents": [{"class": "window", "attributes": ["file_light"]}],
                "color_scheme_tint": "white"
            }
        ]
    }

    If a light color scheme is selected, the second rule should override the color_scheme_tint property of the first rule. So this should make the background of input fields white if a light color scheme is selected, and otherwise black.

  3. Apply a light color scheme (e.g. Breakers).

  4. Open the command palette and observe that the input field is initially black until you hover with the mouse over the command palette overlay. This can be reproduced whenever the command palette is closed and opened again.

    Note that the input fields in the bottom panels ("Find", etc.) initially also have the wrong color with a light color scheme until you hover with the mouse over the panel, but then the color will stay correct even when the panel is closed and opened again. This behavior can be reset after switching to a dark color scheme, opening and closing the panel, and then switching back to a light color scheme again.

    Note also that the color always works correctly for the "Goto Anything", "Goto Symbol" and "Goto Line" overlays.

Expected behavior

With a light color scheme, the input field in the command palette should always be white.

Actual behavior

The input field is black until you hover with the mouse over the command palette.

Sublime Text build number

4180

Operating system & version

Windows 11

(Linux) Desktop environment and/or window manager

No response

Additional information

I think I found a workaround by removing the first theme rule and replacing it with separate rules which are restricted to the luminosity attributes:

{
    "rules":
    [
        {
            "class": "text_line_control",
            "parents": [{"class": "window", "attributes": ["file_medium"]}],
            "color_scheme_tint": "black"
        },
        {
            "class": "text_line_control",
            "parents": [{"class": "window", "attributes": ["file_medium_dark"]}],
            "color_scheme_tint": "black"
        },
        {
            "class": "text_line_control",
            "parents": [{"class": "window", "attributes": ["file_dark"]}],
            "color_scheme_tint": "black"
        },
        {
            "class": "text_line_control",
            "parents": [{"class": "window", "attributes": ["file_light"]}],
            "color_scheme_tint": "white"
        }
    ]
}

But this should not be necessary; the first code snippet should be enough to make it work with all luminosity attributes.

OpenGL context information

No response

deathaxe commented 3 weeks ago

Maybe related with #3929.

deathaxe commented 3 weeks ago

The bug also affects badges, which keep old color after input panel updated color due to hover event.

grafik