feat(tui): RTL/Bidi support for Persian, Arabic, Hebrew, and Urdu text#41462
Open
liuhao1024 wants to merge 1 commit into
Open
feat(tui): RTL/Bidi support for Persian, Arabic, Hebrew, and Urdu text#41462liuhao1024 wants to merge 1 commit into
liuhao1024 wants to merge 1 commit into
Conversation
… text Implements Phase 1 (MVP) of RTL support in the TUI transcript: - Add isRtl() utility using first-strong-character heuristic (CSS direction: auto) - Detect RTL text via Unicode code point ranges (Hebrew, Arabic, Persian, Urdu) - Reverse message row layout (flexDirection=row-reverse) for RTL messages - Right-align message content (alignItems=flex-end) for RTL - Mirror gutter glyph to right side for RTL messages - 10 unit tests covering Persian, Arabic, Hebrew, Urdu, mixed text, ANSI stripping Closes NousResearch#41454
tonydwb
approved these changes
Jun 7, 2026
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
RTL/Bidi support for Persian, Arabic, Hebrew, Urdu — well-scoped, no elsewhere surface area.
Highlights
isRtlfirst-strong-char detection matches CSSdirection: autosemantics, which is what users expect.- Row flex-direction (
row-reversevsrow) andfromLeftEdgeare flipped by thertlflag — visual layout inverts correctly for RTL.
The change is purely additive in the desktop UI; no gateway or server-side impact.
No issues.
Reviewed by Hermes Agent
This was referenced Jun 8, 2026
19 tasks
1 task
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
Implements Phase 1 (MVP) of RTL/Bidi support in the Hermes TUI, making Persian, Arabic, Hebrew, and Urdu text render correctly for ~500M+ potential users.
Problem
Persian, Arabic, Hebrew, and Urdu text renders left-aligned with disconnected letters in the Hermes TUI (
hermes --tui). This makes the TUI unusable for RTL language users.Changes
ui-tui/src/lib/text.tsisRtl()function using the first-strong-character heuristic (matches CSSdirection: autobehavior)ui-tui/src/components/messageLine.tsxflexDirection="row-reverse"for RTL messages (gutter moves to right side)alignItems="flex-end"for RTL message content (right-aligned)fromLeftEdgefor RTL messages (selection zone follows reversed layout)ui-tui/src/__tests__/text.test.tsTesting
All existing tests continue to pass. No new dependencies.
Closes #41454