pytermgui icon indicating copy to clipboard operation
pytermgui copied to clipboard

[BUG] Buttons inside a Splitter are not highlighted

Open AdreamCZ opened this issue 3 years ago • 3 comments
trafficstars

Describe the bug When a button is placed inside a Splitter its style does not change to highlighted when it is selected or hovered over.

To Reproduce Steps to reproduce the behavior:

  1. Create a Splitter
  2. Add a button to the Splitter
  3. Hover over the button

Expected behavior The style should change when hovered over

System information

PyTermGUI version 7.2.0

System details:
    Python version: 3.10.4
    $TERM:          xterm
    $COLORTERM:     None
    Color support:  ColorSystem.STANDARD
    OS Platform:    Linux-5.17.0-2-amd64-x86_64-with-glibc2.33

AdreamCZ avatar Aug 12 '22 13:08 AdreamCZ

No idea why this happens! I'll look into it in the coming days.

P.S.: What terminal are you running to get standard colorsystem? You can most likely change the xterm value to get more colors displayed by the module :)

bczsalba avatar Aug 13 '22 13:08 bczsalba

This is from the KiTTY terminal.

AdreamCZ avatar Aug 17 '22 08:08 AdreamCZ

Kitty as in https://github.com/kovidgoyal/kitty? Does your kitty.conf overwrite the TERM variable?

bczsalba avatar Aug 17 '22 13:08 bczsalba

I tried this with kitty (TERM=xterm-kitty), Alacritty (TERM=alacritty), xterm and gnome-terminal. It's the same behavior in all terminals.

And this does not only affect buttons. InputFields are also not highlighted.

bk90 avatar Oct 13 '22 08:10 bk90

Has anyone figured out a work-around for this type of issue? My current layout is pretty split-heavy so it would be nice to get working.

If I figure something out I'll post it here.

riks-jogi avatar Nov 21 '22 16:11 riks-jogi

Has anyone figured out a work-around for this type of issue? My current layout is pretty split-heavy so it would be nice to get working.

If I figure something out I'll post it here.

For the time being, you can use:

ptg.Splitter.styles.fill = lambda _, item: item

This will overwrite the fill style to return the thing given to it, as opposed to trying to fill it in with some background color. There is a problem somewhere in the chain of StyleManager -> MarkupFormatter MarkupLanguage that causes this issue, but I haven't figured out where exactly.

P.S. The current splitters aren't great, but the upcoming major release will introduce something waaaay nicer to use instead, so look out! :)

bczsalba avatar Nov 21 '22 18:11 bczsalba

This ended up a very lame fix, the markup language doesn't really like escaped tags when they are parsed multiple times, so instead we'll stop using [ as the delimiter char. Sorry for the delay!

bczsalba avatar Apr 18 '23 14:04 bczsalba