/clear command sends \033[3J (erase scrollback) which breaks Windows Terminal IME input on WSL2

Open 💬 0 comments Opened Jul 6, 2026 by Shimura0227

Summary

After running the /clear command in Claude Code CLI, Japanese IME input stops working in the console on WSL2 + Windows Terminal environments.

Environment

  • OS: WSL2 (Ubuntu, Linux 6.18.33.2-microsoft-standard-WSL2)
  • Terminal: Windows Terminal (WT_SESSION present)
  • TERM: xterm-256color
  • Japanese input: handled by Windows IME via Windows Terminal (no Linux IME installed)
  • Claude Code version: 2.1.177

Root Cause

The /clear command sends the following escape sequences:

\033[H   ← cursor home
\033[2J  ← erase display
\033[3J  ← erase scrollback buffer (xterm extension)

The \033[3J sequence resets Windows Terminal's internal state, which breaks the Windows IME integration. After this reset, Japanese (and presumably other CJK language) IME input no longer functions in the Claude Code console.

The issue is specific to the Claude Code console — other terminal windows/panes are unaffected.

Steps to Reproduce

  1. Open Claude Code in WSL2 with Windows Terminal
  2. Confirm Japanese IME input works (e.g., type hiragana)
  3. Run /clear
  4. Attempt to type Japanese — input no longer works

Expected Behavior

IME input should continue to function normally after /clear.

Proposed Fix

Remove \033[3J from the /clear escape sequence. Using only \033[H\033[2J clears the visible screen without erasing the scrollback buffer, which avoids disrupting the terminal's IME state.

Workaround

After /clear, run stty sane in the shell to restore terminal state.

View original on GitHub ↗