[BUG] When terminal sends Focus In/Out events (DECSET 1004), [ I / [ O appear in input. Expected: handled/ignored.

Status Fixed / completed
Maintainer reply None cached
Activity 9 comments · opened Nov 10, 2025 · closed Jan 6, 2026

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?

<img width="167" height="102" alt="Image" src="https://github.com/user-attachments/assets/af04673a-ed6f-488e-86ce-bc0b9d6e43c6" />

When I blur the terminal pane (WezTerm), [O shows up in the input; when I focus the terminal pane (WezTerm), [I shows up in the input. These two reporting are activated when there are multiple terminal panes in the same tab on WezTerm.

What Should Happen?

These two events should be handled gracefully by Claude Code. It could also be explored as user behavioral metrics.

Error Messages/Logs

Steps to Reproduce

  1. Open WezTerm
  2. Run claude
  3. Split the tab window using Shift + Ctrl + Alt + %
  4. Use Shift + Ctrl + Arrow Keys to jump between the two windows, or simply click around with mouse
  5. See focus event characters pop up in Claude Code input box

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.0.36

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Other

Additional Information

_No response_

View original on GitHub ↗

9 Comments

Avishayy · 9 months ago

in my case, this starts happening only after editing a prompt in an external editor (with ctrl+g), before the first use it doesn't happen, but it will persist across the terminal session

tino · 9 months ago

Running into this in Ghostty too. Quite annoying.

abatkin · 9 months ago

Also reproducible using Windows Terminal (in my case via ssh to a Linux box)

raw1z · 9 months ago

I also have the same problem. my stack: macos+ghostty+tmux. I confirm that the problem is triggered by the usage of an external editor with ctrl+g. I use neovim as editor.

axeltlarsson · 9 months ago

I also have this issue - started happening a couple of weeks ago if I am not mistaken.
Using alacritty with Tmux, and it happens regardless of ctrl+g editing in nvim. It happens every time I switch/focus/blur from the tab that I keep Claude in - midly infuriating actually.

0xMH · 9 months ago

I'm seeing this same issue when using Claude Code inside tmux. When I switch to the Claude Code window the text [0[I] appears in the input. I'm using Kitty terminal with tmux and have set -g focus-events on in my tmux config (needed for various terminal applications that rely on focus events).
Disabling focus events (set -g focus-events off) fixes it, but then other terminal applications lose important functionality. It would be great if Claude Code could handle these focus event sequences properly like other TUI apps do.

samuelstevens · 8 months ago

I wrote a short golang wrapper for claude that strips these focus events from inputs to claude (https://github.com/samuelstevens/claude-unfocused) that I alias to claude and it resolves my issues. It would of course be better for claude code to fix this.

pro-vi · 8 months ago

As of 2.0.67 this seems to be fixed. Will close out after some continued observation.

github-actions[bot] · 7 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.