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

Only the last character is entered when I type Japanese.

Open KYB-RLRYMT opened this issue 1 year ago • 12 comments

What happened?

Only the last character is entered when typing Japanese—for example, “こんにちは” ends up as just “は”.

Image

Enter ↓

Image

As of June 27, 2025, text input was working correctly.

What did you expect to happen?

Image

Client information

  • CLI Version: 0.1.8
  • Git Commit: N/A
  • Operating System: darwin v22.13.0
  • Sandbox Environment: no sandbox
  • Model Version: gemini-2.5-pro
  • Memory Usage: 204.2 MB
  • MacOS: 15.5

Login information

No response

Anything else we need to know?

No response

KYB-RLRYMT avatar Jun 28 '25 06:06 KYB-RLRYMT

Thank you for reporting! I can help take a look at this!

heartyguy avatar Jun 28 '25 17:06 heartyguy

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 #2462 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

Hi @heartyguy ,

Thank you so much for the quick response and for implementing the fix in PR #2462! That's great news.

However, I've pulled the changes from PR #2462, rebuilt the project locally, and tested the Chinese input again, but unfortunately, the issue till persists for me.

What I did:

  1. Cloned the repository.
  2. Checked out PR #2462
  3. Ran npm install and npm run build to rebuild the CLI.
  4. Used sudo npm link to use the locally built version.
  5. Tested Chinese input.

The problem I'm still experiencing: When typing Chinese characters using my IME, only the last character of the composed word or phrase appears in the input field. The preceding characters are still discarded. For example, typing "你好" still results in only "好" appearing.

My Environment:

  • OS: macOS (darwin)
  • Terminal: iTerm2 3.5.14
  • Chinese IME: 系统中文输入法 (macOS built-in Chinese Input Method)
  • Gemini CLI Version: Built from source after pulling PR #2462.

│ About Gemini CLI │ │ CLI Version 0.1.8 │ Git Commit dc66fbf0 │ Model gemini-2.5-pro │ Sandbox no sandbox │ OS darwin │ Auth Method OAuth │ Could you please advise on what further information I can provide, or if there's anything else I should try on my end?

Thanks again for your efforts!

shz2050 avatar Jun 29 '25 04:06 shz2050

你好 ,

非常感谢您快速回复并在 PR #2462 中实施修复!这真是个好消息。

然而,我已经从 PR #2462 中拉取了更改,在本地重建了项目,并再次测试了中文输入,但不幸的是,问题仍然存在对我来说仍然存在。

我做了什么:

  1. 克隆了存储库。
  2. 已签收 PR fix: Address IME character sequence issue for East Asian languages #2462
  3. 运行 npm install 和 npm run build 来重建 CLI。
  4. 使用 sudo npm link 来使用本地构建的版本。
  5. 测试中文输入。

**我仍然遇到的问题:**当我使用我的 IME 输入中文字符时,输入字段中只会显示所组成单词或短语的最后一个字符。前面的字符仍然会被丢弃。例如,输入“你好”仍然只会出现“好”。

我的环境:

│ 关于 Gemini CLI ││ CLI 版本 0.1.8│ Git 提交dc66fbf│ 型号 gemini-2.5-pro│ 沙盒 无沙盒│ 达尔文操作系统│ 授权方式 OAuth │您能否建议我可以提供哪些更多信息,或者我是否应该尝试其他方法?

再次感谢您的努力!

你换一个输入法试试呢?

wildcatDownstairs avatar Jun 29 '25 06:06 wildcatDownstairs

我也遇到了同样的问题,我分别尝试了不同的输入法,更换了不同的终端工具,仍然无效 我提供一个排查线索:当我使用 npx https://github.com/google-gemini/gemini-cli 启动的时候,问题是出现的,但是当我使用 npm install -g @google/gemini-cli gemini 启动的时候,问题并没有出现。

neoean avatar Jun 29 '25 08:06 neoean

It seems that way. When I run npx https://github.com/google-gemini/gemini-cli I still encounter an error.

KYB-RLRYMT avatar Jun 30 '25 00:06 KYB-RLRYMT

我也遇到了同样的问题,我分别尝试了不同的输入法,更换了不同的终端工具,仍然无效 我提供一个排查线索:当我使用 npx https://github.com/google-gemini/gemini-cli 启动的时候,问题是出现的,但是当我使用 npm install -g @google/gemini-cli gemini 启动的时候,问题并没有出现。

I have exactly the same experience — when I install with npm install -g @google/gemini-cli and run gemini, the input method works fine with no issues. However, when I use npx https://github.com/google-gemini/gemini-cli to start it, the input method does not work properly — only the last character is committed when typing phrases.

tatsuyuki25 avatar Jun 30 '25 01:06 tatsuyuki25

我也遇到了同样的问题,我分别尝试了不同的输入法,更换了不同的终端工具,仍然无效 我提供一个排查线索:当我使用 npx https://github.com/google-gemini/gemini-cli 启动的时候,问题是出现的,但是当我使用 npm install -g @google/gemini-cli gemini 启动的时候,问题并没有出现。

I have exactly the same experience — when I install with npm install -g @google/gemini-cli and run gemini, the input method works fine with no issues. However, when I use npx https://github.com/google-gemini/gemini-cli to start it, the input method does not work properly — only the last character is committed when typing phrases.

The version of gemini-cli installed via npm install -g @google/gemini-cli is 0.1.7, and under this version, the input method functions normally.

The problematic version is 0.1.8. When launching with the command npx https://github.com/google-gemini/gemini-cli, the version retrieved is precisely this 0.1.8, which causes the input method to not work correctly.

shz2050 avatar Jun 30 '25 03:06 shz2050

我也遇到了同样的问题,我分别尝试了不同的输入法,更换了不同的终端工具,仍然无效 我提供一个排查线索:当我使用 npx https://github.com/google-gemini/gemini-cli 启动的时候,问题是出现的,但是当我使用 npm install -g @google/gemini-cli gemini 启动的时候,问题并没有出现。

I have exactly the same experience — when I install with npm install -g @google/gemini-cli and run gemini, the input method works fine with no issues. However, when I use npx https://github.com/google-gemini/gemini-cli to start it, the input method does not work properly — only the last character is committed when typing phrases.

The version of gemini-cli installed via npm install -g @google/gemini-cli is 0.1.7, and under this version, the input method functions normally.

The problematic version is 0.1.8. When launching with the command npx https://github.com/google-gemini/gemini-cli, the version retrieved is precisely this 0.1.8, which causes the input method to not work correctly.

Although it’s only a temporary workaround, we were able to resolve the issue since this command lets us use v0.1.6. npx https://github.com/google-gemini/gemini-cli#v0.1.7

Do you know how to use v0.1.7?

KYB-RLRYMT avatar Jun 30 '25 05:06 KYB-RLRYMT

我也遇到了同样的问题,我分别尝试了不同的输入法,更换了不同的终端工具,仍然无效 我提供一个排查线索:当我使用 npx https://github.com/google-gemini/gemini-cli 启动的时候,问题是出现的,但是当我使用 npm install -g @google/gemini-cli gemini 启动的时候,问题并没有出现。

I have exactly the same experience — when I install with npm install -g @google/gemini-cli and run gemini, the input method works fine with no issues. However, when I use npx https://github.com/google-gemini/gemini-cli to start it, the input method does not work properly — only the last character is committed when typing phrases.

The version of gemini-cli installed via npm install -g @google/gemini-cli is 0.1.7, and under this version, the input method functions normally. The problematic version is 0.1.8. When launching with the command npx https://github.com/google-gemini/gemini-cli, the version retrieved is precisely this 0.1.8, which causes the input method to not work correctly.

Although it’s only a temporary workaround, we were able to resolve the issue since this command lets us use v0.1.6. npx https://github.com/google-gemini/gemini-cli#v0.1.7

Do you know how to use v0.1.7?

@KYB-RLRYMT I am currently using this method to utilize v0.1.7

npm install -g @google/gemini-cli
gemini

shz2050 avatar Jun 30 '25 06:06 shz2050

Fixed in #2504.

SandyTao520 avatar Jul 01 '25 23:07 SandyTao520

Fixed in #2504.

I have confirmed that the Japanese-language fixes when using npm on macOS have been completed. Thank you.

KYB-RLRYMT avatar Jul 02 '25 02:07 KYB-RLRYMT