claude-code - 💡(How to fix) Fix [BUG] Diff highlight (teal SGR background) bleeds past changed text in 2.1.150–2.1.153

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Error Messages/Logs

Fix Action

Fix / Workaround

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

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • 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/[email protected]
  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/[email protected]), 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.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING