fix(cli): use rich.Table for resume session list to fix CJK alignment#44203
Open
Weidows wants to merge 1 commit into
Open
fix(cli): use rich.Table for resume session list to fix CJK alignment#44203Weidows wants to merge 1 commit into
Weidows wants to merge 1 commit into
Conversation
Replace basic str.format() column padding with rich.table.Table which
properly handles CJK (double-width) characters. Also rearrange columns
so that 'Last Active' and 'ID' appear on the left side, keeping the
variable-length 'Title / Preview' on the right where width doesn't
affect alignment of other columns.
Changes:
- cli.py (_show_recent_sessions): switch from print(f'{:32}') to
rich.table.Table with CJK-aware column widths; merge Title + Preview
into a single column; increase preview width from 38 to 80 chars.
- hermes_cli/main.py (cmd_sessions 'list'): same treatment for the
'hermes sessions list' command — rich.table.Table with columns
reordered to Last Active | ID | Title | Preview.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replace
str.format()fixed-width table rendering withrich.table.Tablein the/resumeinline session list andhermes sessions listcommand. Fixes CJK (Chinese/Japanese/Korean) character alignment by using Rich's Unicode-aware column width handling.Before
After
Changes
cli.py—_show_recent_sessions()print(f"{'#':<3} {'Title':<32} ...")withrich.table.Tablehermes_cli/main.py—cmd_sessions()list actionrich.table.TablemigrationValidation
test_show_recent_sessions_includes_indexes_and_resume_hint,test_resume_list_shows_full_long_titles) confirmed compatibleCloses #44199