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
[FEATURE]: Add RTL (Right-to-Left) language support in the chat panel #26915
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Summary
OpenCode currently does not support RTL text rendering in the chat panel. Arabic, Hebrew, and Persian-speaking users experience broken text alignment and poor readability when writing in their native languages.
Problem
When a user types in Arabic (or any RTL language) in the chat input:
Text alignment is LTR by default, making RTL text appear reversed or unreadable.
There is no option to manually switch the chat panel direction.
Mixed LTR/RTL content (e.g., Arabic prompt + English code) is not handled gracefully.
Proposed Solution
Auto-detect text direction using the Unicode Bidirectional Algorithm (bidi) — automatically switch alignment based on the first characters typed.
Manual toggle — allow users to set a preferred text direction in settings:
{
"chat": {
"textDirection": "auto"
}
}
Options: "auto" | "ltr" | "rtl"
Per-message direction — each chat bubble should render in the correct direction based on its content language.
Why This Matters
Arabic-speaking developers are a significant and growing user base in the Middle East and globally. RTL support is a basic accessibility requirement for these users and is standard in all major chat-based tools (Slack, Discord, VS Code chat extensions).
Without RTL support, Arabic developers are forced to write their prompts in English even when they prefer Arabic — this creates a significant barrier to adoption.
Detailed root-cause analysis and a fully tested fix recipe (CSS/JS, with before/after screenshots on Desktop 1.17.13) is available in #35319 — covers word ordering, alignment, and table column direction for Arabic/RTL.
For those looking for RTL support, we've built an OpenCode plugin that automatically applies Unicode bidi isolation (RLI/LRI/PDI) to the AI's responses and system prompts.
Injects RTL system prompts so the AI responds in your language
Protects inline code (console.log()) and markdown blocks from getting scrambled by wrapping them in LTR isolates
Works out-of-the-box for Arabic, Persian, Hebrew, Urdu, etc.
Fixes character ordering and mixed-direction (BiDi) text issues
Current limitations:
Right-alignment: The plugin fixes the ordering of words and code (which fixes a lot of the unreadable output), but the text is still left-aligned. Full right-alignment requires native support in the renderer (like CSS dir="rtl" as discussed in this issue, or native alignment in the CLI TUI).
Streaming: It formats the text after the response completes. (We are proposing a streaming hook to fix this).
The opencode-rtl plugin adds RTL support for chat via OpenCode's plugin system. It isolates RTL text with bidi markers, handles code blocks and tables, and guides the model to respond with proper RTL formatting.
Confirming this is still present in v2 (TUI 2.0.27, Windows 11 + Windows Terminal). Typing Persian in the composer renders word-by-word reversed LTR, e.g. typing Persian displays reversed and unreadable. Same in message replies. No client-side setting affects it (font change does not help - layout/bidi, not coverage). Happy to test any fix build on Windows.
+1 for the Desktop app specifically — this is what keeps Arabic-first users on other tools.
I work in Arabic (RTL reports, decks, urban indicators). In the Desktop chat panel, mixed Arabic/English messages lose per-line direction: a line that starts with a Latin token (a path, a number, an ID) flips to LTR and the surrounding Arabic reorders, so every such line has to be re-read to parse.
Minimum that would unblock, without a full i18n pass:
Per-message direction detection from the first strong character, plus a manual per-message override.
dir="auto" + unicode-bidi: plaintext on message bodies, list items and table cells.
Code blocks stay LTR; Arabic inside comments/strings still renders connected.
A setting Text direction: Auto / LTR / RTL to force a direction per workspace.
You're asking for proper right-to-left support in the chat: automatic direction detection, a setting to force auto/ltr/rtl, and the right direction for each message.
Much of this is already in OpenCode v2 (2.x) desktop/web:
The prompt input sets its direction from what you type (dir="auto"). Shell mode stays left-to-right.
Each message, and each Markdown block inside it, sets its own direction, and code stays left-to-right. An Arabic prompt with English code inside should display correctly.
The app layout supports RTL in general.
If you're on an older version, please try the latest 2.x release.
What isn't there yet is a setting like "textDirection": "rtl" that forces one direction instead of detecting it. I've passed that to the maintainers to consider.
Related issues, in case one of them matches what you're seeing:
Activity
github-actions commentedon May 11, 2026
This issue might be a duplicate of existing issues. Please check:
Please review these issues and consider adding your input there instead of opening a new one.
hbx12 commentedon May 30, 2026
Hi maintainers,
I'd like to help move Arabic/RTL support forward.
I'm a native Arabic speaker and an active OpenCode user. I can help with:
I'm happy to start with small PRs and work closely with the team's preferred direction.
I'd also be interested in helping maintain Arabic localization and RTL QA long-term.
Thanks.
Musa85 commentedon Jul 4, 2026
Detailed root-cause analysis and a fully tested fix recipe (CSS/JS, with before/after screenshots on Desktop 1.17.13) is available in #35319 — covers word ordering, alignment, and table column direction for Arabic/RTL.
razavioo commentedon Jul 29, 2026
Community plugin available:
opencode-rtlFor those looking for RTL support, we've built an OpenCode plugin that automatically applies Unicode bidi isolation (RLI/LRI/PDI) to the AI's responses and system prompts.
What it fixes today:
console.log()) and markdown blocks from getting scrambled by wrapping them in LTR isolatesCurrent limitations:
dir="rtl"as discussed in this issue, or native alignment in the CLI TUI).Repo: https://github.com/razavioo/opencode-rtl
razavioo commentedon Sep 27, 2026
The opencode-rtl plugin adds RTL support for chat via OpenCode's plugin system. It isolates RTL text with bidi markers, handles code blocks and tables, and guides the model to respond with proper RTL formatting.
Supports Arabic, Hebrew, Persian, Urdu, and 6 other RTL languages with automatic detection.
mehran282 commentedon Oct 12, 2026
Confirming this is still present in v2 (TUI 2.0.27, Windows 11 + Windows Terminal). Typing Persian in the composer renders word-by-word reversed LTR, e.g. typing Persian displays reversed and unreadable. Same in message replies. No client-side setting affects it (font change does not help - layout/bidi, not coverage). Happy to test any fix build on Windows.
Hona commentedon Oct 12, 2026
can you try the GUI/Desktop app on v2?
it should have okay-ish
RTL support
Nasrallah1995 commentedon Oct 20, 2026
+1 for the Desktop app specifically — this is what keeps Arabic-first users on other tools.
I work in Arabic (RTL reports, decks, urban indicators). In the Desktop chat panel, mixed Arabic/English messages lose per-line direction: a line that starts with a Latin token (a path, a number, an ID) flips to LTR and the surrounding Arabic reorders, so every such line has to be re-read to parse.
Minimum that would unblock, without a full i18n pass:
dir="auto"+unicode-bidi: plaintexton message bodies, list items and table cells.Text direction: Auto / LTR / RTLto force a direction per workspace.Related: #16875 (reversed/disconnected Arabic characters), #39525 (TUI renderer).
بالعربية: النص العربي في المحادثة يختلط اتجاهه ويحتاج دعماً أصلياً في لوحة المحادثة.
opencodejr commentedon Oct 29, 2026
Thanks for the request, @datacodexlab!
You're asking for proper right-to-left support in the chat: automatic direction detection, a setting to force
auto/ltr/rtl, and the right direction for each message.Much of this is already in OpenCode v2 (2.x) desktop/web:
dir="auto"). Shell mode stays left-to-right.If you're on an older version, please try the latest 2.x release.
What isn't there yet is a setting like
"textDirection": "rtl"that forces one direction instead of detecting it. I've passed that to the maintainers to consider.Related issues, in case one of them matches what you're seeing:
Contextnumbers #55913: RTL line wrapping overlaps the context numbersopencode-rtlcan help thereIf something still looks wrong in the latest 2.x, please open a bug report with your version (
opencode --version), your platform and a screenshot.