anomalyco / anomalyco/opencode

RTL/bidi broken for mixed Arabic-script + Latin text in TUI

Open
#40,286 3 comments 0 reactions 1 assignee View on GitHub

@kommander is already working on this.

Since Aug 3, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Environment: opencode 1.18.11, Windows, reproduced identically in both Windows Terminal and the desktop app.

Any line containing both Persian/Arabic (RTL) and an embedded Latin word (LTR) renders in scrambled order instead of correct right-to-left. Pure single-direction lines render fine.

The TUI appears to lay text out cell-by-cell in a monospace grid without applying the Unicode bidi algorithm, so directional runs within a line are not reordered correctly. Since this reproduces identically across terminals, it is the opencode renderer, not the terminal.

Example: a Persian sentence containing an embedded Latin token (e.g. a filename or config key) renders with wrong character order wherever the Latin token sits mid-Persian.

There is no config option for this (checked the config schema - no rtl/bidi/direction field). Please add proper Unicode bidi handling (and ideally RTL shaping) to the TUI text renderer.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.