Fix rich display padding by using .maximum attribute

This commit is contained in:
2025-10-30 19:21:29 +01:00
parent cceb082631
commit eede9a3560

View File

@@ -70,7 +70,7 @@ def main():
# Calculate padding to fill terminal width
# 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.
rendered_length = console.measure(formatted_message).cell_len
rendered_length = console.measure(formatted_message).maximum
padding = max(0, console.width - rendered_length)
padded_message = f"{formatted_message}{' ' * padding}"
@@ -93,4 +93,4 @@ def main():
console.print(f"[green]Chat log saved to {log_filename}[/green]")
if __name__ == '__main__':
main()
main()