You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support RTL/BiDi text rendering in CLI output #38524
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:
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.
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.
Configuration flag — add an \
tl\\ or \\�idi\\ option that users in RTL locales can enable.
None are exact duplicates because this issue targets the CLI terminal (stdout TTY rendering — Unicode control characters / UAX#9 reordering), whereas the others all target the Desktop app's HTML/CSS renderer. Same family of problems (BiDi support), different layers of the stack — fixing one won't fix the other.
If someone wants to take on the Desktop side, #35319 has a thorough, tested fix recipe ready to go.
Unicode bidi isolation (RLI/LRI/PDI) for RTL paragraphs, headings, lists, blockquotes, and table cells
Inline code spans are LTR-isolated inside RTL text (e.g. fetchData() stays correct inside Persian prose)
System prompt injection so the model responds in the user's RTL language
Auto-detection of Arabic, Persian, Hebrew, Urdu, Pashto, and more
Digit conversion (preserve / latin / arabic-indic / eastern-arabic)
What it can't do (needs core changes):
Right-alignment — Unicode bidi controls character ordering but not paragraph alignment. The TUI renderer would need native dir="rtl" paragraph alignment support.
Streaming formatting — experimental.text.complete only fires after the full response. A text.delta or text.partial mutation hook would let plugins format text as it streams.
Until native BiDi support lands in OpenCode's TUI renderer, the opencode-rtl plugin provides a working solution.
It wraps RTL text segments with Unicode bidi isolates (U+2067 RLI / U+2069 PDI), handles mixed LTR/RTL content (code blocks, tables, inline code), and rewrites the assistant's SSE stream so model output renders correctly in bidi-capable terminals.
Works with OpenCode 1.x (0.1.9) and OpenCode 2.x (1.0.0).
Activity
github-actions commentedon Jul 23, 2026
This issue might be a duplicate of existing issues. Please check:
Please review those issues to see if your report is already covered, and consider adding any new details there instead.
yanivhrs commentedon Jul 23, 2026
Related issues check — conclusion:
unicode-bidi: plaintext)None are exact duplicates because this issue targets the CLI terminal (stdout TTY rendering — Unicode control characters / UAX#9 reordering), whereas the others all target the Desktop app's HTML/CSS renderer. Same family of problems (BiDi support), different layers of the stack — fixing one won't fix the other.
If someone wants to take on the Desktop side, #35319 has a thorough, tested fix recipe ready to go.
razavioo commentedon Jul 29, 2026
Community plugin available:
opencode-rtlWhile waiting for native RTL/BiDi support in the CLI renderer, we built an opencode plugin that tackles this at the plugin layer:
# Install npm install opencode-rtlWhat it does today:
fetchData()stays correct inside Persian prose)What it can't do (needs core changes):
dir="rtl"paragraph alignment support.experimental.text.completeonly fires after the full response. Atext.deltaortext.partialmutation hook would let plugins format text as it streams.Repo: https://github.com/razavioo/opencode-rtl
Would love to see native BiDi-aware rendering in the CLI output — this plugin is a bridge until then.
razavioo commentedon Sep 27, 2026
Until native BiDi support lands in OpenCode's TUI renderer, the opencode-rtl plugin provides a working solution.
It wraps RTL text segments with Unicode bidi isolates (U+2067 RLI / U+2069 PDI), handles mixed LTR/RTL content (code blocks, tables, inline code), and rewrites the assistant's SSE stream so model output renders correctly in bidi-capable terminals.
Works with OpenCode 1.x (
0.1.9) and OpenCode 2.x (1.0.0).neriousy commentedon Oct 1, 2026
Closing as a duplicate of #16875. Same request: RTL/BiDi rendering in the terminal UI. Tracking in #16875.