Skip to content

Support RTL/BiDi text rendering in CLI output #38524

Description

@yanivhrs

Problem

When typing or displaying Hebrew (and other RTL scripts) in opencode's CLI interface, the text renders with broken BiDi — characters appear in the wrong visual order because most terminal emulators lack proper bidirectional text support.

This affects a significant user base (Hebrew, Arabic, Persian, Urdu, etc.) and is not a trivial cosmetic issue — it makes the tool unusable for prompts and responses in RTL languages.

Example

Typing Hebrew text in the chat produces output where words appear disjointed or in reverse order, depending on the surrounding LTR characters.

Suggested approach

Some possible mitigations at the application level:

  1. Unicode BiDi control characters — wrap detected RTL text segments with RLM (U+200F) or LRM (U+200E) markers to give terminals a hint about direction.
  2. Bidi algorithm implementation — apply the Unicode Bidirectional Algorithm (UAX#9) to reorder text before writing to stdout, so the terminal receives already-correctly-ordered glyphs.
  3. Configuration flag — add an \
    tl\\ or \\�idi\\ option that users in RTL locales can enable.

Environment

  • opencode CLI (terminal interface)
  • Windows Terminal / iTerm2 / etc.
  • Hebrew locale / RTL input

References

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions