Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange widget border in 256-color terminal #5101

Closed
TomJGooding opened this issue Oct 9, 2024 · 9 comments
Closed

Strange widget border in 256-color terminal #5101

TomJGooding opened this issue Oct 9, 2024 · 9 comments

Comments

@TomJGooding
Copy link
Contributor

I noticed that the Checkbox widget now has a strange border in urxvt. I assume this is specific to 256-color terminals, as I couldn't replicate the issue in other modern emulators.

Here's screenshots of the checkbox.py example before and after Textual 0.80.0:

Before v0.80.0 After 0.80.0
Before v0.80.0 After 0.80.0
Copy link

github-actions bot commented Oct 9, 2024

We found the following entry in the FAQ which you may find helpful:

Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.

This is an automated reply, generated by FAQtory

@TomJGooding
Copy link
Contributor Author

After some further testing, I found other widgets also have this issue:

Before v0.80.0 After 0.80.0
Before v0.80.0 After 0.80.0

@TomJGooding TomJGooding changed the title Strange Checkbox border in 256-color terminal Strange widget border in 256-color terminal Oct 9, 2024
@TomJGooding
Copy link
Contributor Author

TomJGooding commented Oct 9, 2024

Reverting commit 17097e6 seems to fix this issue, although I don't understand why as the only change was reversing the foreground and background colors. This also doesn't explain why this strange border only appears on the left on specific widgets.

@darrenburns
Copy link
Member

darrenburns commented Oct 10, 2024

I can see similar artifacts in iTerm 2 - but only when the app itself does not have focus:

image

On second thought this may be related to iTerm 2 paints the "dimming overlay" over a terminal window when it loses focus and how that overlay interacts with "reverse" control sequences.

@willmcgugan
Copy link
Collaborator

I suspect a bug in urxvt. There was a change in how some borders were rendered recently, but I'm pretty sure urxvt is doing something wrong with the control sequences given.

Will keep the issue open. At some point I'll dig out a linux VM and give it a try.

@TomJGooding
Copy link
Contributor Author

Interesting, apparently trying to reverse the same background/foreground color does produce unexpected results. I wonder if this is specific to urxvt then!

image

from rich.console import Console
from rich.style import Style
from rich.text import Text

red_on_red_style = Style(color="red", bgcolor="red")
reversed_style = red_on_red_style + Style(reverse=True)

console = Console()
console.print(Text("Red on red", style=red_on_red_style))
console.print(Text("Reversed", style=reversed_style))

@willmcgugan
Copy link
Collaborator

Yeah. It looks like it ignores colours when the reverse style is set!

@TomJGooding
Copy link
Contributor Author

After some digging into the urxvt CVS, it looks like this was an intentional design decision. Shame as otherwise Textual works well in urxvt, but maybe time to switch to a more modern emulator! Closing.

  • text with background==foreground colour gets displayed with default
    bg/fg now when in reverse video, so it can be seen when selecting.

Copy link

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants