You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm coming from textual, the tui framework. I was printing paragraphs in Label and added a \t before each to add a tab. As I was resizing the window, I noticed that some paragraphs were not aligned anymore - some had extra spaces. I have set the css of that label to "text-align: justify;" to justify it fully - (from left to right).
Here is how the issue looks like :
As you can see, the space of the indentation for the first paragraph changes.
I tracked down the issue and these are my findings :
In textual, \t is converted with 8 spaces and uses rich to split and justify the text
In rich, the text is split for each word using " " so a space. Problem is, the 8 spaces from textual are treated as 8 words in addition to the "real" ones. Therefore, in the current implementation when the text is justified, space are set between words, but the spaces are too.
Below is rich in debug mode of the containers.py file :
You can see that the first line is split by " " and the variable "spaces" hold the amount of spaces to append for each word. In he "spaces" variable the first "words" (spaces) have more than 1 space, therefore spaces are also considered as words.
The issue here is that the tab (\t) is converted to spaces and these spaces are justified and so the size of the tab is bigger than the default 8
What platform (Win/Linux/Mac) are you running on? What terminal software are you using?
ubunu 24.04
The text was updated successfully, but these errors were encountered:
Describe the bug
I'm coming from textual, the tui framework. I was printing paragraphs in Label and added a \t before each to add a tab. As I was resizing the window, I noticed that some paragraphs were not aligned anymore - some had extra spaces. I have set the css of that label to "text-align: justify;" to justify it fully - (from left to right).
Here is how the issue looks like :
As you can see, the space of the indentation for the first paragraph changes.
I tracked down the issue and these are my findings :
In textual, \t is converted with 8 spaces and uses rich to split and justify the text
In rich, the text is split for each word using " " so a space. Problem is, the 8 spaces from textual are treated as 8 words in addition to the "real" ones. Therefore, in the current implementation when the text is justified, space are set between words, but the spaces are too.
Below is rich in debug mode of the containers.py file :
You can see that the first line is split by " " and the variable "spaces" hold the amount of spaces to append for each word. In he "spaces" variable the first "words" (spaces) have more than 1 space, therefore spaces are also considered as words.
The issue here is that the tab (\t) is converted to spaces and these spaces are justified and so the size of the tab is bigger than the default 8
What platform (Win/Linux/Mac) are you running on? What terminal software are you using?
ubunu 24.04
The text was updated successfully, but these errors were encountered: