hermes - 💡(How to fix) Fix Two TUI rendering bugs: CJK cursor offset + infinite scroll loop on long voice conversations (v0.15.2)

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

After a long conversation session in --tui mode (especially when using macOS built-in dictation for continuous voice input), the TUI enters an infinite rendering loop:

  1. Display breaks — the output area becomes visually corrupted
  2. Content starts scrolling downward rapidly, one line at a time
  3. Lines accumulate extremely fast, reaching 50+ lines in seconds
  4. The composer/input area becomes visually unusable

Root Cause

CJK characters are double-width (2 columns) but the composer rendering treats them as single-width. Each CJK character shifts the visual cursor by 1 extra column, causing cumulative visual misalignment without corrupting the actual text.

RAW_BUFFERClick to expand / collapse

Environment

  • Hermes Version: v0.15.2 (2026.5.29.2)
  • Mode: --tui (Ink-based React TUI) — not the default prompt_toolkit CLI
  • Terminal: macOS Terminal.app
  • Language: Chinese (CJK input + speech-to-text via macOS built-in dictation)

Bug 1: CJK character cursor offset in input area (visual only, text output is correct)

Description

When typing Chinese characters in the --tui composer/input box, the visual rendering is incorrect during editing, but the final text output is normal:

  1. Type a segment of Chinese text (e.g. 今天天气很好)
  2. Continue typing more characters — the new characters visually appear starting from the left of the existing text, as if the cursor jumped
  3. Once the input is submitted (Enter/voice send), the output text order is completely normal — it's purely a display/rendering issue

The cursor position becomes progressively offset as CJK characters are typed, but only visually. The actual text buffer is correct.

Root cause

CJK characters are double-width (2 columns) but the composer rendering treats them as single-width. Each CJK character shifts the visual cursor by 1 extra column, causing cumulative visual misalignment without corrupting the actual text.

Related issues

  • #5221 — TUI input box renders incorrectly for Chinese/East Asian wide characters
  • #7443 — CLI TUI renders and deletes Chinese characters incorrectly
  • PR #5539 — fix(cli): handle CJK wide chars in TUI input height (partial fix)

Steps to reproduce

  1. Run hermes --tui
  2. Type some Chinese text, e.g. 今天天气很好
  3. Continue typing more — new characters appear at the left side instead of after existing text
  4. Submit the text — output order is normal, no data corruption

Expected behavior

Visual cursor stays aligned with the actual character being typed. What you see during editing should match the actual text buffer.


Bug 2: Infinite scroll/render loop during long voice sessions

Description

After a long conversation session in --tui mode (especially when using macOS built-in dictation for continuous voice input), the TUI enters an infinite rendering loop:

  1. Display breaks — the output area becomes visually corrupted
  2. Content starts scrolling downward rapidly, one line at a time
  3. Lines accumulate extremely fast, reaching 50+ lines in seconds
  4. The composer/input area becomes visually unusable

Recovery (not Ctrl+C)

The fix is simple: turn off voice recognition (close dictation). The display immediately recovers and everything shows normally again. No need to kill the process.

Trigger conditions

  • Long conversation session with many turns (50+ messages)
  • Continuous voice input (macOS dictation) that keeps the conversation flowing
  • The bug typically manifests after the output content fills the visible terminal area

Suspected root cause

Related to #19216 — terminal resize causes infinite scroll/render loop. In the --tui Ink-based rendering, when the output area fills the viewport, the scrollback-diff check in ui-tui/packages/hermes-ink/src/ink/log-update.ts can trigger a fullReset on every frame:

  1. fullReset clears and repaints the terminal
  2. After repaint, scrollback rows differ from the previous frame
  3. Scrollback-diff triggers another fullReset
  4. Infinite loop — line count scrolls endlessly

Voice input makes this more noticeable because:

  • Each voice input produces a complete message, accelerating session growth
  • The user doesn't pause between turns, so the bug manifests mid-conversation rather than at a natural break

Steps to reproduce

  1. Run hermes --tui
  2. Engage in a long conversation (30+ turns, enough to fill terminal scrollback)
  3. Continue conversing via voice input — at some point the display starts scrolling infinitely
  4. Lines accumulate rapidly
  5. Turn off dictation/voice input — display recovers immediately

Expected behavior

Long sessions should not trigger infinite rendering loops. The output area should remain stable regardless of conversation length.

Related issues

  • #19216 — TUI: terminal resize causes infinite scroll/render loop
  • PR #19225 — fix(tui): avoid main-screen scrollback reset loops
  • PR #21257 — fix(tui): avoid main-screen scrollback reset loops (salvage #19225)
  • #15926 — perf(tui): stabilize long-session scrolling

Both bugs significantly impact CJK/voice users in daily --tui usage — Bug 1 makes typing visually confusing beyond a few characters, and Bug 2 makes long voice sessions unstable.

Note: These bugs are specific to --tui (Ink-based) mode. The default CLI mode (prompt_toolkit) is not affected.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Long sessions should not trigger infinite rendering loops. The output area should remain stable regardless of conversation length.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix Two TUI rendering bugs: CJK cursor offset + infinite scroll loop on long voice conversations (v0.15.2)