gemini-cli icon indicating copy to clipboard operation
gemini-cli copied to clipboard

Typing in Chinese in gemini-cli, only the last character is displayed

Open johnsmith8736 opened this issue 1 year ago • 3 comments

What happened?

Typing in Chinese in gemini-cli, only the last character is displayed

What did you expect to happen?

Typing in Chinese in gemini-cli, only the last character is displayed

Client information

$ gemini /about
# paste output here

Login information

No response

Anything else we need to know?

No response

johnsmith8736 avatar Jun 28 '25 08:06 johnsmith8736

Hi @johnsmith8736, I'm trying to reproduce this issue but haven't been able to yet. Could you provide some additional details to help debug this?

Environment details:

  • What operating system are you using? (Windows, macOS, Linux distribution)
  • What terminal are you using? (Terminal.app, cmd, PowerShell, WSL, etc.)
  • What Chinese input method are you using? (Pinyin, Zhuyin, etc.)

Reproduction steps:

  • Are you typing Chinese characters directly, or using an IME?
  • Does this happen with all Chinese text or specific characters?
  • Can you share a screenshot or video of the issue?

Additional context:

  • What version of gemini-cli? (gemini --version)
  • Does this happen in other terminals/applications, or just gemini-cli?

This will help narrow down the root cause. Thanks!

chingchun94 avatar Jun 28 '25 11:06 chingchun94

+1

I use npx https://github.com/google-gemini/gemini-cli from macOS. --version shows 0.1.8

Terminal.app in VSCode

Pinyin (whether Baidu Pinyin or Pinyin from macOS)

All Chinese text more than one word will only input the last word, even English words from input method tool gets the last character.

Yesterday it works good but goes wrong today.

ptclist avatar Jun 28 '25 13:06 ptclist

Good news! I've identified and fixed the issue where only the last character appears when typing Japanese/Chinese text.

The problem was caused by a React state closure issue in the text-buffer.ts file, where the cursor position was stuck at 0 when processing IME input. This caused new characters to be inserted at the beginning instead of being appended.

I've created PR #2458 with a minimal fix that detects this condition and ensures characters are inserted at the correct position.

The fix has been tested with:

  • Chinese input: 你好世界 ✅
  • Japanese input: こんにちは ✅
  • Korean input: 안녕하세요 ✅
  • Mixed English/CJK input ✅

All characters now appear correctly as you type them. Thank you for reporting this issue!

heartyguy avatar Jun 28 '25 17:06 heartyguy