fix(tui): stabilize resize and IME rendering#30775
Open
energypantry wants to merge 1 commit into
Open
Conversation
5aa9a34 to
e6797da
Compare
This was referenced May 30, 2026
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.
Fixes #18449
Refs #5221
Refs #24137
Summary
This patch tightens several related TUI rendering paths that can leave the visible transcript or composer in an inconsistent state after terminal resize or IME-heavy input.
Why
The existing fixes cover pieces of the problem, but resize and IME paths can still diverge:
Manual verification
I reproduced the issue locally in a Chinese-language workflow using Apple Terminal with Chinese/CJK mixed output and long Chinese input containing ASCII skill names. Before this patch, resizing the terminal could truncate the visible transcript tail, and submitted Chinese input could leave stale/overlapping text in the composer area. I also reproduced the later post-response case where output looks correct until the terminal is resized in the opposite direction or scrolled away/back to the bottom. After rebuilding and restarting the local Hermes TUI, the same Chinese environment no longer reproduces those rendering artifacts: output remains visible after terminal resize, reverse resize, and scroll-back-to-bottom, and Chinese/mixed-width submitted input no longer overlaps the prompt/composer area.
Tests
npm test -- --run packages/hermes-ink/src/ink/scrollbox-overflow.test.tsx src/__tests__/virtualHistoryOffsetCache.test.ts src/__tests__/virtualHeights.test.ts src/__tests__/textInputWrap.test.ts src/__tests__/textInputFastEcho.test.ts src/__tests__/cursorDriftRegression.test.ts packages/hermes-ink/src/ink/terminal.test.ts packages/hermes-ink/src/ink/log-update.test.tsnpx prettier --check ui-tui/src/hooks/useVirtualHistory.ts ui-tui/src/app/useMainApp.ts ui-tui/src/__tests__/virtualHistoryOffsetCache.test.ts ui-tui/src/lib/virtualHeights.ts ui-tui/src/lib/inputMetrics.ts ui-tui/src/components/textInput.tsx ui-tui/src/components/appLayout.tsx ui-tui/packages/hermes-ink/src/ink/ink.tsx ui-tui/packages/hermes-ink/src/ink/components/ScrollBox.tsx ui-tui/packages/hermes-ink/src/ink/render-node-to-output.ts ui-tui/packages/hermes-ink/src/ink/scrollbox-overflow.test.tsxnpm run buildNote:
npm run type-checkstill fails on pre-existingpackages/hermes-ink/src/utils/execFileNoThrow.tsNode overload errors unrelated to this patch.