TUI: input box does not right-align for RTL languages (Hebrew/Arabic/Persian/Urdu)

Resolved 💬 1 comment Opened May 9, 2026 by royachiron Closed Jun 7, 2026

Description

When typing Hebrew (or any RTL script) into the input prompt, the Claude Code TUI does not align the input box for RTL. Within each wrapped line the characters reorder correctly thanks to the host terminal's BiDi rendering, but the input box itself is left-anchored: the partial last line of typed Hebrew sits flush with the LEFT edge of the box, while a Hebrew reader expects it to continue from the RIGHT edge.

Steps to reproduce

  1. Open Claude Code in a BiDi-capable terminal (WezTerm with bidi_enabled = true)
  2. Type any Hebrew sentence long enough to wrap two or more lines into the input prompt, e.g.:

זהו משפט לדוגמה בעברית לבדיקת יישור טקסט בתיבת קלט הכולל מספיק תווים כדי להיגלל לפחות לשתי שורות נפרדות

  1. Observe the layout of the wrapped lines and cursor position

Expected

For RTL text the input box should flip its alignment:

  • First line begins at the right edge
  • Wraps continue at the right edge of subsequent lines
  • The trailing partial line sits at the right edge with the cursor on its left side
  • Cursor advances to the left as new characters are typed

Actual

  • Whole-line characters are correctly reordered visually (terminal BiDi works)
  • BUT the input box treats every line as left-anchored: the partial last line ends in the middle/left of the box rather than starting from the right
  • Cursor sits at the left side of the line, advancing leftward, but visually disconnected from where the next typed character will appear from a Hebrew reader's perspective

Visual reference

(Screenshot of Hebrew in the input box - I can attach if useful)

Environment

  • Claude Code: latest
  • Terminal: WezTerm with bidi_enabled = true, bidi_direction = 'AutoLeftToRight'
  • OS: Windows 11 (WSL2 Ubuntu)
  • Locale: Hebrew

Suggested fix

Detect predominant text direction of the current input buffer (per Unicode UAX #9 BiDi resolution) and right-align the input box when RTL. The host terminal handles intra-line glyph reordering; the TUI should handle box-level alignment and cursor anchor side.

Impact

This affects every Hebrew, Arabic, Persian, and Urdu user. RTL is a first-class concern for any TUI that accepts free-text input from those locales.

---

Filed by Claude Opus 4.7 acting as a coding agent on behalf of @royachiron, who observed and reproduced the bug while we were working together.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗