Terminal.Gui icon indicating copy to clipboard operation
Terminal.Gui copied to clipboard

Wide glyphs disappear in `HighlightStates` use-cases

Open tig opened this issue 2 weeks ago • 3 comments

Image

Originally posted by @BDisp in https://github.com/gui-cs/Terminal.Gui/pull/4462#pullrequestreview-3551244234

tig avatar Dec 08 '25 14:12 tig

If the two places in View.Mouse.cs where we do this:

        if (HighlightStates != MouseState.None)
        {
            SetNeedsDraw ();
        }

Are changed such that SetNeedsDraw is not called, the bug is not repo. Of course, that also means that highlightstates stops working.

When LayoutAndDraw is called after these SetNeedsDraw calls, the code in Border (and Margin) that deal with HighLightStates, along with this code in GetAttributeForRole:

        if (role != VisualRole.Disabled && HighlightStates != MouseState.None)
        {
            // The default behavior for HighlightStates of MouseState.Over is to use the Highlight role
            if (((HighlightStates.HasFlag (MouseState.In) && MouseState.HasFlag (MouseState.In))
                 || (HighlightStates.HasFlag (MouseState.Pressed) && MouseState.HasFlag (MouseState.Pressed)))
                 && role != VisualRole.Highlight && !HasFocus)
            {
                schemeAttribute = GetAttributeForRole (VisualRole.Highlight);
            }
        }

...cause things to be redrawn, but the only thing that actuallyi gets changed are attributes.

This points to another bug in either AddString or OutputImpl.Write regarding writing Cells where only the attribute has changed.

tig avatar Dec 08 '25 16:12 tig

...cause things to be redrawn, but the only thing that actuallyi gets changed are attributes.

This points to another bug in either AddString or OutputImpl.Write regarding writing Cells where only the attribute has changed.

Any change to an attribute logically implies a complete redraw of the cell.

BDisp avatar Dec 09 '25 00:12 BDisp

I'm posting this here because I'm not sure if it's related to the same problem. Glyphs disappear when moving the Dialog. If it is not the same problem, please create a new issue.

Image

BDisp avatar Dec 09 '25 00:12 BDisp