[BUG] Diff highlight (teal SGR background) bleeds past changed text in 2.1.150–2.1.153

Resolved 💬 1 comment Opened May 28, 2026 by b2528261 Closed Jun 29, 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?

The inline diff highlight (teal/green background that marks changed text in Edit / Write tool output) renders with an unterminated ANSI SGR escape sequence. The background color bleeds past the actual changed span — sometimes to end-of-line, sometimes across multiple following lines — until an unrelated SGR reset happens to fire.

Affected versions:

  • 2.1.149 — correct (last known-good)
  • 2.1.150 — broken
  • 2.1.151 — not tested
  • 2.1.152 — broken
  • 2.1.153 — broken (latest)

Behavior is intermittent within a single session: an Edit diff at the top of a transcript can be broken while a later Update diff in the same session renders correctly. See attached screenshot.

What Should Happen?

The teal/green background should be bounded by the actual changed span. Surrounding context and subsequent lines should render with normal terminal styling — same as in 2.1.149.

Error Messages/Logs

Steps to Reproduce

  1. npm install -g @anthropic-ai/claude-code@2.1.153
  2. Start a new session in any project.
  3. Ask Claude to make any small edit using the Edit tool (e.g., rename a variable).
  4. Observe the diff output — teal background extends past the changed text.

Reproduces on both macOS Terminal.app and iTerm2; both light and dark themes; single-line and multi-line edits.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.153 (also seen on 2.1.150, 2.1.152)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

<img width="1055" height="690" alt="Image" src="https://github.com/user-attachments/assets/6c51781e-b19d-4214-808c-9e632568aa0d" />

Suspected cause: opening SGR (e.g. \x1b[48;5;...m) emitted without a matching \x1b[0m / \x1b[49m at the end of the highlighted span. The close was guarded in 2.1.149 but lost in 2.1.150 and hasn't been restored since.

Workaround: pin to 2.1.149 (npm install -g @anthropic-ai/claude-code@2.1.149), set DISABLE_AUTOUPDATER=1 in ~/.zshrc, and fully quit + relaunch running CC processes (they hold the broken binary in memory).

Originally reported via /bug on 2026-05-28 from 2.1.149 after downgrading; filing here for public tracking + screenshot.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗