pytermgui
pytermgui copied to clipboard
[BUG] Buttons inside a Splitter are not highlighted
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:
- Create a Splitter
- Add a button to the Splitter
- 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
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 :)
This is from the KiTTY terminal.
Kitty as in
https://github.com/kovidgoyal/kitty? Does your kitty.conf overwrite the TERM variable?
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.
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.
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! :)
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!