anomalyco / anomalyco/opencode

Chinese input renders as blank for a single CJK character in VSCode integrated terminal

Open
#41,678 1 comment 0 reactions 1 assignee View on GitHub

@kommander is already working on this.

Since Aug 11, 2026.

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

Description

Description

Chinese input renders as blank for a single CJK character in VSCode integrated terminal

Environment

  • OS: Ubuntu 20.04

  • VSCode: 1.132.0

  • Terminal: VSCode integrated terminal

  • $TERM: xterm-256color

  • pi: 0.84.1

  • opencode: 1.17.18

  • Input method: Fcitx

  • XMODIFIERS: @im=fcitx

  • GTK_IM_MODULE: fcitx

  • QT_IM_MODULE: fcitx

  • Locale: en_US.UTF-8

Problem

When using pi or opencode interactively inside the VSCode integrated terminal, a single Chinese/CJK character is rendered as blank.

For example:

Input:
你

Result:
[blank]

However, if multiple Chinese characters are entered in the same input operation, they are rendered correctly:

你好   -> works
你你 -> works

But entering the characters separately does not work:

你     -> blank
你 -> blank

Other combinations also show the same problem:

你a    -> the Chinese character is blank
a你 -> the Chinese character is blank

Reproduction

  1. Open a VSCode integrated terminal.

  2. Start pi:

pi
  1. Use a Chinese input method and enter a single character:


  1. The character is not visible / appears as blank.

Entering multiple CJK characters in one operation works:

你好

Important observations

I tested several other programs in the same VSCode integrated terminal.

cat
cat

Input:


Result: works correctly

Python
python3 -c 'import sys; print(sys.stdin.read().encode())'

Input:

你好世界

Result:

b'\xe4\xbd\xa0\xe5\xa5\xbd\xe4\xb8\x96\xe7\x95\x8c\n'

The UTF-8 input is received correctly.

nano
nano /tmp/test.txt

Input:


Result: works correctly

vim
vim /tmp/test.txt

Input:


Result: works correctly

pi via stdin
printf '你' | pi

Result: works correctly

This suggests that pi can correctly process the UTF-8 character itself. The problem appears specifically during interactive TUI input.

TTY configuration

VSCode terminal:

TERM=xterm-256color

stty -a shows:

cs8
iutf8
icanon
echo
isig

and the same basic configuration is present in the normal system terminal.

Fcitx test

I also tested without the Fcitx-related environment variables:

env -u XMODIFIERS -u GTK_IM_MODULE -u QT_IM_MODULE pi

The problem remains:

你 -> blank

Therefore, simply removing the Fcitx environment variables does not resolve the issue.

Comparison

The issue appears to be specific to interactive TUI applications such as pi and opencode:

Application Single 你
cat Works
Python Works
nano Works
vim Works
printf '你' | pi Works
pi interactive TUI Blank
opencode interactive TUI Blank

Suspected cause

The issue seems related to interactive TUI input/rendering of a single CJK character, possibly involving Unicode grapheme width, cursor positioning, incremental redraw, or terminal input handling.

The fact that:

你       -> blank
你好     -> works
你你     -> works

suggests that the problem may occur specifically when the TUI performs an incremental redraw after receiving a single CJK character.

It does not appear to be a general UTF-8, locale, Fcitx, VSCode terminal, or font rendering problem, since the same terminal correctly handles Chinese input in cat, nano, vim, and Python.

Could you please help determine whether this is a known issue in the TUI/input rendering layer, and whether there is a workaround or configuration to fix it?

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

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.