question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Right-justified text overflowing

See original GitHub issue

Describe the bug A clear and concise description of what the bug is. Using justify='right' on a console with smaller width than full width over-reaches the width:

image

To Reproduce A minimal code example that reproduces the problem would be a big help if you can provide it. If the issue is visual in nature, consider posting a screenshot.

from rich.console import Console
from rich.rule import Rule

console = Console(width=100)

console.print(Rule('A Title'))
console.print("Some normal text", end='')
console.print("right-justified", justify='right')

image

Platform What platform (Win/Linux/Mac) are you running on? What terminal software are you using. Which version of Rich?

On Manjaro linux. Problem seen in Terminator and also the Pycharm terminal.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
steven-murraycommented, Jul 22, 2020

Excellent, thanks! It might be useful to have this use-case in the docs somewhere.

On Wed, Jul 22, 2020 at 7:06 AM Will McGugan notifications@github.com wrote:

The first argument in add_column is the header, but a grid has the table header disabled. You want to add two columns then add a row. Something like this…

from rich.table import Tablefrom rich.text import Textfrom rich import print table = Table.grid()table.expand = Truetable.add_column(style=“bold”)table.add_column(style=“blue”, justify=“right”)table.add_row(“foo”, “bar”)print(table)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/willmcgugan/rich/issues/165#issuecomment-662473679, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJWRXS3PVC2A746D4O6DADR43W6BANCNFSM4PEBOMMA .

0reactions
willmcgugancommented, Jul 22, 2020

The first argument in add_column is the header, but a grid has the table header disabled. You want to add two columns then add a row. Something like this…

from rich.table import Table
from rich import print

table = Table.grid()
table.expand = True
table.add_column(style="bold")
table.add_column(style="blue", justify="right")
table.add_row("foo", "bar")
print(table)
Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] Right-justified text overflowing · Issue #165
Describe the bug A clear and concise description of what the bug is. Using justify='right' on a console with smaller width than full...
Read more >
Text-align justify but to the right?
We want to make text-align:justify, to take all the width of the column, but it should start from the right side. Is there...
Read more >
text-align right bug - Forum
The first and third sentences leave it ambiguous, as the overflow could be in either direction, or determined by the text-align property. But ......
Read more >
Box alignment and overflow
The solution I came up with is, instead of setting a justify-content: flex-end to align the messages to the bottom of the message...
Read more >
169937 - text-align: center + text-overflow: ellipsis alignment
Issue 169937: text-align: center + text-overflow: ellipsis alignment ... 2. See that the two lines are not horizontally aligned. You may have to ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found