anomalyco / anomalyco/opencode
[FEATURE] Native RTL (Right-to-Left) alignment in TUI renderer
@simonklee is already working on this.
Since Jul 29, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
- I have verified this feature I'm about to request hasn't been suggested before.
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:
- #38524 reports BiDi character ordering bugs — this issue is specifically about paragraph alignment (right-aligning text in the terminal), which is a different rendering concern.
- #26915 targets the Desktop/Electron app (CSS
dirattribute) — this issue targets the CLI/TUI renderer (terminal padding/alignment). - #32984 reports that Persian/Arabic text is "not displayed correctly" — this issue proposes a concrete implementation for right-alignment specifically, which none of the above issues address with a proposed solution for the TUI.
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.