Skip to content

[FEATURE] Native RTL (Right-to-Left) alignment in TUI renderer #39525

Description

@razavioo

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:

Proposed Solution

Add native support to the TUI renderer to detect and align RTL text.

  1. 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).
  2. 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.
  3. 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.

Activity

  1. github-actions commented on Jul 29, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • The Feature Request template requires a verification checkbox confirming you have checked that this feature hasn't been suggested before. Please include: - [ ] I have verified this feature I'm about to request hasn't been suggested before.

    Please edit this issue to address the above within 2 hours, or it will be automatically closed.


    This issue might be a duplicate of existing issues. Please check:

    If you believe this was flagged incorrectly, please let a maintainer know.

  2. added
    needs:complianceThis means the issue will auto-close after 2 hours.
    and removed
    needs:complianceThis means the issue will auto-close after 2 hours.
    on Jul 29, 2026
  3. github-actions commented on Jul 29, 2026

    @github-actions
    Contributor

    Thank you for updating the issue! It now looks great — the verification checkbox is checked, the problem is clearly explained, and the proposed solution is well thought out. The needs:compliance label has been removed.

  4. razavioo commented on Sep 27, 2026

    @razavioo
    Author

    Until native RTL alignment lands in the TUI renderer, the opencode-rtl plugin is the community workaround. It uses Unicode bidi isolates at the text level so terminals with bidi support render RTL correctly.

    The related request in #39526 (streaming text transformation hook) was partly what motivated the v1.0.0 rewrite — since OpenCode 2 removed the text.complete hook, the plugin now intercepts the provider SSE stream via http.response to apply bidi isolation to assistant text as it streams.

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