Fix rich display padding by using .maximum attribute
This commit is contained in:
@@ -70,7 +70,7 @@ def main():
|
|||||||
# Calculate padding to fill terminal width
|
# Calculate padding to fill terminal width
|
||||||
# rich handles rendering, so we need to calculate the visible width of the string
|
# rich handles rendering, so we need to calculate the visible width of the string
|
||||||
# and pad it. This is a simplified approach, rich's Panel might be better for complex layouts.
|
# and pad it. This is a simplified approach, rich's Panel might be better for complex layouts.
|
||||||
rendered_length = console.measure(formatted_message).cell_len
|
rendered_length = console.measure(formatted_message).maximum
|
||||||
padding = max(0, console.width - rendered_length)
|
padding = max(0, console.width - rendered_length)
|
||||||
padded_message = f"{formatted_message}{' ' * padding}"
|
padded_message = f"{formatted_message}{' ' * padding}"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user