[BUG] Chinese IME candidate window position incorrect inside Zellij (Linux / ibus-libpinyin / xterm)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When running Claude Code inside Zellij (0.44.1), the Chinese IME (ibus-libpinyin) candidate window does not follow the cursor position. The candidate window either appears at the wrong location or fails to display properly.
Critically, a regular xterm pane in the same Zellij session has correct IME candidate positioning. This confirms the issue is specific to Claude Code's TUI rendering, not Zellij or the terminal.
This is consistent with the analysis in #30982 — Ink's rendering loop moves the terminal cursor for UI drawing, so when the IME framework queries the cursor position, it gets the rendering position rather than the actual input position.
What Should Happen?
The IME candidate window should appear at the correct position (near the text input cursor) inside Claude Code, just as it does in a normal shell prompt in the same terminal/multiplexer environment.
Steps to Reproduce
- Open xterm on Linux (X11)
- Launch Zellij with two panes side by side
- In the left pane, run
claude(Claude Code) - In the right pane, keep a normal shell
- Switch to Chinese IME (ibus-libpinyin) and type in both panes
- Right pane (normal shell): IME candidate window correctly follows the cursor ✅
- Left pane (Claude Code): IME candidate window does NOT follow the cursor ❌
Environment
- OS: AlmaLinux 8.10 (Cerulean Leopard), kernel 4.18.0-553.69.1.el8_10.x86_64
- Terminal: xterm (TERM=xterm-256color)
- Multiplexer: Zellij 0.44.1
- IME: IBus 1.5.19 + ibus-libpinyin
- Desktop: X11
- Claude Code version: 2.1.114
Claude Model
Opus 4.6
Is this a regression?
I don't know
Platform
Anthropic API
Operating System
Other Linux
Terminal/Shell
Other
Related Issues
- #1547 — IME input causes performance issues and duplicate conversion candidates (macOS, assigned to @chrislloyd)
- #30982 — IME candidate window not displayed in Claude Code interactive TUI (Linux, closed as stale)
- #40195 — Chinese IME candidate window position incorrect in Warp Terminal (closed as duplicate of #1547)
Additional Context
A commenter on #30982 noted that OpenCode (a Go TUI built with Bubble Tea) works correctly with IME in the exact same terminal setup, further confirming this is an Ink/React-CLI cursor management issue rather than a terminal or IME limitation.
The root cause appears to be that Ink moves the terminal cursor during its render cycle, and does not restore it to the logical input position afterward. IME frameworks (ibus/fcitx) query the terminal for cursor coordinates to position their candidate window, and receive the wrong (post-render) coordinates.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗