Skip to content

[FEATURE]: RTL (Right-to-Left) / Bidirectional text support for TUI input and chat rendering #51005

Closed as duplicate

Description

@hoshangrazay

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Summary

Add support for Right-to-Left (RTL) languages (such as Kurdish, Arabic, Persian, and Hebrew) in the TUI prompt editor and message viewports.

Problem

When typing RTL text (such as Kurdish Sorani کوردی) in the OpenCode TUI prompt input (internal/tui/components/chat/editor.go), characters are rendered Left-to-Right (LTR), causing text to appear mirrored and out of order.

The Charm bubbles/textarea widget used by OpenCode does not perform Unicode Bidirectional Algorithm (UBA) visual reordering before rendering lines to the terminal buffer.

Requested Solution

  • Apply visual BiDi reordering/reshaping (e.g. using golang.org/x/text/unicode/bidi) in editor.go View() method so RTL character runs render right-to-left within the prompt widget.
  • Ensure chat response viewports handle RTL/LTR mixed text correctly without corrupting layout.

Workaround currently used

Opening an external editor with Ctrl+E ($EDITOR).

Activity

  1. razavioo commented on Sep 30, 2026

    @razavioo

    While core TUI BiDi reordering is being developed, you can use the community plugin opencode-rtl (v1.0.0 is now live on npm) to resolve the chat response and BiDi isolation issues:

    // opencode.jsonc (OpenCode 2)
    {
      "plugins": [
        {
          "package": "opencode-rtl",
          "options": {
            "language": "auto"
          }
        }
      ]
    }

    What it handles right now:

    • Unicode BiDi Isolates (RLI / PDI): Wraps RTL prose so terminals with BiDi support (WezTerm, iTerm2, Windows Terminal, Ghostty) render words and sentences in the correct visual order.
    • Mixed Code & Text Protection: Protects inline code blocks, commands, and markdown formatting markers from getting inverted inside RTL sentences.
    • System Prompting: Injects language guidance so the model understands and structures RTL output properly.
    • Multi-language Support: Automatically detects Kurdish, Persian, Arabic, Hebrew, Urdu, and other RTL scripts.

    Repo: https://github.com/razavioo/opencode-rtl
    npm: https://www.npmjs.com/package/opencode-rtl

  2. neriousy commented on Oct 1, 2026

    @neriousy
    Member

    Closing as a duplicate of #16875. Same request: RTL/bidirectional text in TUI input and chat. Tracking in #16875.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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