-
Notifications
You must be signed in to change notification settings - Fork 38
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
Default value gets moved to its own line when the description is 2+ lines long #35
Comments
Oh, that's super weird! Took me a moment to understand what you mean, but I get the same too by changing window width.. One line, default stays inline: Two lines, default moves onto its own line: This has got to be something weird with the way I'm using Rich to join these elements together. I'm using a list of renderables (can be different types, eg. rich-click/src/rich_click/rich_click.py Lines 230 to 232 in 66b584c
@willmcgugan - any ideas why this behaviour happens? Is there a way to get around this / a better way to join these? |
Minimal example with pure rich code: from rich import print
from rich.console import Console
from rich.columns import Columns
from rich.markdown import Markdown
from rich.text import Text
shortext = Text("Short text")
longtext = Text("Some long text. See there how easy that is. It's amazing what you can do with a little love in your heart. Some long text. See there how easy that is. It's amazing what you can do with a little love in your heart.")
appended = Text.from_markup("[red]APPENDED RED TEXT[/]")
print(Columns([shortext, appended]))
print("-----")
print(Columns([longtext, appended])) $ python minimal_example.py
Short text APPENDED RED TEXT
-----
Some long text. See there how easy that is. It's amazing what you can do with a little love in your
heart. Some long text. See there how easy that is. It's amazing what you can do with a little love
in your heart.
APPENDED RED TEXT |
Sorry, stream of consciousness here. I guess what rich is doing makes sense - they're called columns and you can't split a vertical column if the text wraps over a line. So to get around this we need a different approach. The columns was suggested here: Textualize/rich#1951 (reply in thread) because using We can't just concatenate the string and then format that, because the help text can be one of: raw text, rich markup text, markdown. The default should always be a rich My best idea currently is to do |
I'm not really sure if this is the expected behavior. If so, please ignore this issue.
When an option descriptions is 2+ lines long, the default value text is moved to an additional line, even when it would fit by the side of the description.
Current behavior:
What I expected:
Vanilla click:
The text was updated successfully, but these errors were encountered: