-
Notifications
You must be signed in to change notification settings - Fork 815
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
Rendering issue with soft hyphens (~~long/wrapped text in OptionList
~~)
#4073
Comments
Update: I'm starting to suspect it doesn't have much to do with long/wrapped text at all, and it could be there is a problematic character or similar in the underlying data. I'm thinking this based on the fact that, while testing/developing some more just now, I got the same issue, only this time, if I make the window wide enough that the suspect word itself doesn't overflow, I still see the rendering issue: I'll leave this open for now and see if I can hunt down the question itself (it's simply pulled down from the API and used in-app; no copy is stored locally, so I an't view the underlying data), but this seems less of an issue now. |
Found it. And if I copy the question from the web view and paste it into a scratch buffer in Emacs: Inspecting what it is: |
Good catch. Soft hyphens. Zero length, they indicate where the word is permitted to wrap. Rich is reporting them as having a length of 1, where they should have a cell length of 0. |
We should make @darrenburns's day by plugging this into soft-wrapped |
OptionList
OptionList
~~)
I think this may be fixable from Rich. If you tackle this, ask @willmcgugan for an overview of how Rich calculates cell lengths. |
Bug Textualize/textual#4073 showed that the version of wcwidth we are using incorrectly reports the soft hyphen (codepoint 173, 0xAD) has having length 1.
Bug Textualize/textual#4073 showed that the version of wcwidth we are using incorrectly reports the soft hyphen (codepoint 173, 0xAD) has having length 1.
@willmcgugan as discussed, it was enough to update |
@willmcgugan for this to be fixed in Textual we need a Rich release and then we need to update the Rich dependency in Textual. |
Can do a Rich release shortly. Can I just confirm that you have tested Textual with the update to Rich, and it fixes this issue? |
Yes. I installed rich locally and this fixed the issue in Textual. |
Pushed Rich 13.7.1 |
Rich 13.7.1 introduces the fix for #4073.
Since we won't be pinning rich to 13.7.1, this can be closed already. |
Don't forget to star the repository! Follow @textualizeio for Textual updates. |
At the suggestion of @willmcgugan I'm recording this without an MRE (although I have tried to make one; see below). In an application I'm currently toying with, over the weekend, I ran into this curious rendering bug:
Note the effect seen to the right of question 9.
The widget is an
OptionList
, theOption
s within are made up of Rich renderables which in turn are made up of aGroup
that contains twoTable.grid
s.I've attempted to isolate the issue from the wider application, adding all the relevant styles (also doing it as a
ModalScreen
as this was part of such):the result however seems fine:
The text was updated successfully, but these errors were encountered: