Skip to content

Thai SARA AM (U+0E33) width mismatch causing erratic line jumping and output duplication (spamming) in tmux #25369

@billnitiup

Description

@billnitiup

What happened?

When using Gemini CLI inside a tmux environment, any Thai text containing the character SARA AM (U+0E33) triggers severe rendering bugs that make
the CLI unusable.

Symptoms identified:

  1. Output Duplication (Streaming Spam): When the AI streams a response containing SARA AM, the terminal fails to refresh the current line
    correctly. Instead, it "spams" the same line multiple times vertically. (e.g., a single bullet point appearing 8-10 times, as shown in the
    attached example).
  2. Self-Jumping Input Line: During interactive typing, entering SARA AM causes the current input line to "jump" downward spontaneously, leaving
    large vertical gaps between the prompt and the previous output.
  3. Cursor Desync: The internal layout engine (Ink) loses track of the actual cursor position because it perceives SARA AM as part of a 1-column
    cluster, while tmux/terminal renders it as a 2-column sequence.

The Technical Root Cause:

  • Ink's behavior: Uses Intl.Segmenter which merges Consonant + SARA AM into a single grapheme cluster of width 1.
  • tmux/xterm.js behavior: Renders the same sequence across 2 columns (matching standard wcwidth logic).
  • The Mismatch: Since the terminal's physical cursor is 1 unit ahead of where Ink thinks it is, every frame refresh results in Ink sending "move
    cursor" or "clear line" commands to incorrect coordinates. This triggers tmux to scroll or wrap lines prematurely to protect the buffer, leading
    to the "spamming" effect.

What did you expect to happen?

The CLI should maintain a 1:1 coordinate sync with the terminal grid. Typing or streaming SARA AM should result in a single, stable line of text
without triggering unintended line breaks or duplicated output.

Client information

Client Information

Run gemini to enter the interactive CLI, then run the /about command.

> /about
╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                   │
│ About Gemini CLI                                                                                                                                  │
│                                                                                                                                                   │
│ CLI Version                                        0.37.2                                                                                         │
│ Git Commit                                         545e956c3                                                                                      │
│ Model                                              gemini-3-flash-preview                                                                         │
│ Sandbox                                            no sandbox                                                                                     │
│ OS                                                 linux                                                                                          │
│ Auth Method                                        Signed in with Google                                             │
│ Tier                                               Gemini Code Assist in Google One AI Pro                                                        │
│                                                                     │
│                                                                                                                                                   │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Login information

Logged in via Google Account.

Anything else we need to know?

  • Platform: Linux (Debian) + tmux.
  • Consistency: This issue is exclusive to SARA AM (U+0E33). Other Thai combining marks (vowels/tones) work correctly because both Ink and
    terminals agree they have 0 width.
  • Replicability: The issue is highly replicable by simply asking the AI to "Response in Thai with words like 'กำลัง', 'ทำ', 'แนะนำ'".

Visual Evidence of the "Spam" bug:

มันทำอะไรได้บ้าง? (The God Mode)
มันทำอะไรได้บ้าง? (The God Mode)
มันทำอะไรได้บ้าง? (The God Mode)
มันทำอะไรได้บ้าง? (The God Mode)
... (repeated multiple times for a single output line)

Proposed Fix:
Update the string-width calculation within the Ink library to treat U+0E33 as having a visual width of 1, effectively making the Consonant + SARA
AM cluster have a total width of 2, aligning it with the behavior of terminal grids.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/coreIssues related to User Interface, OS Support, Core Functionalityhelp wantedWe will accept PRs from all issues marked as "help wanted". Thanks for your support!

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions