From 7a4ad5ccb472eed67b4287a4df9d2abb12a2255c Mon Sep 17 00:00:00 2001 From: NorethSea <39730900+NorethSea@users.noreply.github.com> Date: Tue, 12 May 2026 16:43:28 -0700 Subject: [PATCH] fix(cli): use display-width for response box header label to support CJK MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace `len(label)` with `HermesCLI._status_bar_display_width(label)` in two places where the response box top border is rendered. `len()` counts characters, not terminal columns. CJK characters like `测` and `试` each occupy 2 columns, causing the top border `╭─ 测试 ───╮` to render 2 columns wider than the bottom border `╰─────────╯`. The `_status_bar_display_width` helper already exists (line 2881) and uses `prompt_toolkit.utils.get_cwidth` for proper CJK width calculation. --- cli.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli.py b/cli.py index 0666d74ba58..da2f32954ba 100644 --- a/cli.py +++ b/cli.py @@ -3669,7 +3669,7 @@ class HermesCLI: if self.show_timestamps: label = f"{label} {datetime.now().strftime('%H:%M')}" w = shutil.get_terminal_size().columns - fill = w - 2 - len(label) + fill = w - 2 - HermesCLI._status_bar_display_width(label) _cprint(f"\n{_ACCENT}╭─{label}{'─' * max(fill - 1, 0)}╮{_RST}") self._stream_buf += text @@ -10393,7 +10393,7 @@ class HermesCLI: label = " ⚕ Hermes " if self.show_timestamps: label = f"{label}{datetime.now().strftime('%H:%M')} " - fill = w - 2 - len(label) + fill = w - 2 - HermesCLI._status_bar_display_width(label) _cprint(f"\n{_ACCENT}╭─{label}{'─' * max(fill - 1, 0)}╮{_RST}") _cprint(f"{_STREAM_PAD}{sentence.rstrip()}")