Description
The CLI/TUI renderer currently assumes all text is Left-to-Right (LTR). When a user configures OpenCode to speak an RTL language (Arabic, Persian, Hebrew) or uses an RTL plugin like opencode-rtl, the text's unicode character ordering can be fixed via BiDi control characters, but the text remains strictly left-aligned.
In right-to-left languages, reading left-aligned text is incredibly jarring. We need a way for the TUI to right-align blocks of text that are predominantly RTL.
Why this is not a duplicate:
Proposed Solution
Add native support to the TUI renderer to detect and align RTL text.
- Detection: When rendering a block of text (paragraph, list item, etc.), check if the first strong directional character is RTL (or if the block contains a high percentage of RTL characters).
- Alignment: If the block is RTL, pad the text with spaces on the left side instead of the right side, effectively right-aligning it in the terminal window.
- Configuration: This could be an explicit setting in
opencode.json (e.g., "ui": { "rtl": true }) or auto-detected.
Alternative Solution
If native detection is too complex for the TUI renderer (Ink/React), expose a styling primitive or terminal width variable to plugins so they can pad strings manually to achieve right-alignment.
Context
See the opencode-rtl community plugin (https://github.com/razavioo/opencode-rtl) which solves the unicode bidi ordering problems, but is currently blocked from fully solving the UX because it cannot control terminal alignment.
Description
The CLI/TUI renderer currently assumes all text is Left-to-Right (LTR). When a user configures OpenCode to speak an RTL language (Arabic, Persian, Hebrew) or uses an RTL plugin like
opencode-rtl, the text's unicode character ordering can be fixed via BiDi control characters, but the text remains strictly left-aligned.In right-to-left languages, reading left-aligned text is incredibly jarring. We need a way for the TUI to right-align blocks of text that are predominantly RTL.
Why this is not a duplicate:
dirattribute) — this issue targets the CLI/TUI renderer (terminal padding/alignment).Proposed Solution
Add native support to the TUI renderer to detect and align RTL text.
opencode.json(e.g.,"ui": { "rtl": true }) or auto-detected.Alternative Solution
If native detection is too complex for the TUI renderer (Ink/React), expose a styling primitive or terminal width variable to plugins so they can pad strings manually to achieve right-alignment.
Context
See the
opencode-rtlcommunity plugin (https://github.com/razavioo/opencode-rtl) which solves the unicode bidi ordering problems, but is currently blocked from fully solving the UX because it cannot control terminal alignment.