fix(cli): prevent status bar wrapping into duplicate rows (#3883)

- measure status bar display width using prompt_toolkit cell widths
- trim rendered status text when fragments would overflow
- add a final single-fragment fallback to prevent wrapping
- update width assertions to validate display cells instead of len()
This commit is contained in:
kshitij 2026-03-30 12:29:07 +05:30 committed by GitHub
parent a347921314
commit c288bbfb57
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 90 additions and 44 deletions

View file

@ -214,8 +214,9 @@ class TestStatusBarWidthSource:
frags = cli_obj._get_status_bar_fragments()
total_text = "".join(text for _, text in frags)
assert len(total_text) <= width + 4, ( # +4 for minor padding chars
f"At width={width}, fragment total {len(total_text)} chars overflows "
display_width = cli_obj._status_bar_display_width(total_text)
assert display_width <= width + 4, ( # +4 for minor padding chars
f"At width={width}, fragment total {display_width} cells overflows "
f"({total_text!r})"
)