Skip to content

macOS/iTerm2: Hebrew (RTL) text renders reversed inside herdr panes #5118

Open
barnuri/herdr
#1

Description

@GalShnapp

Is this a reproducible bug?

  • I confirm this is a reproducible bug, not a feature request, idea, question, contribution proposal, or direction check.
  • I reproduced this bug on the version and environment reported below using the exact steps provided.

Current behavior

Hebrew (right-to-left) text is displayed in reversed character order inside a herdr pane: שלום is shown as םולש. This happens with plain shell output, not only with agent TUIs.

Expected behavior

Hebrew text displays in the same order inside a herdr pane as it does in the host terminal outside herdr.

Reproduction

  1. In iTerm2, start herdr and open a shell pane.
  2. Run: echo 'TEST1: שלום world 123'
  3. שלום is rendered as םולש.
  4. Run the same command in a plain iTerm2 tab outside herdr: it renders correctly.

Impact

Any Hebrew output, including coding-agent responses, is unreadable inside herdr. The current workaround is to read it outside herdr.

Environment

  • herdr: 0.9.3
  • Terminal: iTerm2 3.7.4
  • OS: macOS (Darwin 25.5.0)
  • TERM inside pane: xterm-256color

Activity

  1. added
    triagedScreened; left open for investigation or maintainer judgment. Not proof of a bug or reproduction.
    p2valid narrow or ordinary defect with limited impact or a practical workaround
    macosaffects macOS-specific behavior
    renderingterminal emulation, reflow, layout, graphics, or output rendering
    maintainer-neededrequires maintainer judgment or maintainer-only reproduction
    on Oct 9, 2026
  2. barnuri commented on Oct 23, 2026

    @barnuri

    I implemented this as an opt-in pane display transform in herdr itself, so Hebrew/Arabic render correctly in every outer terminal (VS Code, Ghostty, iTerm), not just ones with BiDi support.

    • Config: [ui] pane_transforms = ["bidi"] (default off, live reload)
    • Uses the unicode-bidi crate (UAX fix: support IME input for Chinese and other UTF-8 characters #9). ASCII rows are untouched; a full screen of Hebrew adds about 0.2 ms per frame.
    • Copy stays in logical order, and mouse clicks are mapped back to logical columns.
    • Before/after screenshots and tests are in the PR.

    PR: #5500 (mirror: barnuri#1)

    The PR gate may auto-close it because I'm not on APPROVED_CONTRIBUTORS. If a maintainer wants this, please reopen it or add me to the list.

  3. MMTE commented on Oct 25, 2026

    @MMTE

    Confirming this reproduces on Persian too, with a byte-level detail that may help the investigation.

    • herdr 0.9.5 stable, macOS (Darwin 25.6.0, arm64), iTerm2, TERM=xterm-256color inside panes
    • printf 'سلام دنیا TESTING 123' in a pane: reversed order and unjoined letterforms — Persian needs contextual shaping, so it is doubly unreadable
    • the same command in a plain iTerm2 tab outside herdr renders correctly
    • captured the client's output through a pty: ASCII in the same line is written as contiguous runs, but every RTL letter is emitted as an individually cursor-positioned cell (ESC[2;70Hل, ESC[2;71Hا, ESC[2;72Hم, …), so the host terminal never receives a contiguous run to reorder or shape
    • a debug build that writes RTL words as contiguous logical-order runs renders correctly in iTerm2; same bytes reproduced on Linux

    Happy to provide full captures if useful. Technical follow-up posted on #5500.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    macosaffects macOS-specific behaviormaintainer-neededrequires maintainer judgment or maintainer-only reproductionp2valid narrow or ordinary defect with limited impact or a practical workaroundrenderingterminal emulation, reflow, layout, graphics, or output renderingtriagedScreened; left open for investigation or maintainer judgment. Not proof of a bug or reproduction.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions