claude-code - 💡(How to fix) Fix Claude Code sets SGR 4 (underline) globally, never clears it — causes visual artifacts in terminals [1 participants]

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…
GitHub stats
anthropics/claude-code#46719Fetched 2026-04-12 13:34:51
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
labeled ×4

Claude Code v2.1.101 sets SGR 4 (underline attribute) at the start of its TUI rendering and never sends SGR 24 or SGR 0 to clear it. This causes every character in the Claude Code interface to have the underline attribute set — including box-drawing characters, spaces, and regular text.

Root Cause

Claude Code v2.1.101 sets SGR 4 (underline attribute) at the start of its TUI rendering and never sends SGR 24 or SGR 0 to clear it. This causes every character in the Claude Code interface to have the underline attribute set — including box-drawing characters, spaces, and regular text.

Code Example

SGR 4 (plain) -> underline=1 row=1 col=0
PRINT U+256D '╭' with underline=1 style=1 row=1 col=0
PRINT U+2500 '─' with underline=1 style=1 row=1 col=1
...
PRINT U+0043 'C' with underline=1 style=1 row=1 col=5   (letter 'C' in "Claude Code")
PRINT U+006C 'l' with underline=1 style=1 row=1 col=6
...
RAW_BUFFERClick to expand / collapse

Description

Claude Code v2.1.101 sets SGR 4 (underline attribute) at the start of its TUI rendering and never sends SGR 24 or SGR 0 to clear it. This causes every character in the Claude Code interface to have the underline attribute set — including box-drawing characters, spaces, and regular text.

Impact

Terminal emulators that render underlines faithfully (positioned below the text baseline) show visible horizontal lines across the entire Claude Code UI — under borders, text, and separators. This makes the interface look broken.

Konsole (KDE) happens to position its underlines at the font's descender line where they overlap with character glyphs and are visually hidden, but this is incidental — the underline data is still on every cell.

Steps to Reproduce

  1. Run claude in any terminal emulator
  2. Enable SGR debug logging or inspect cell attributes
  3. Observe that SGR 4 is set on row 1 col 0 and never cleared
  4. All subsequent characters inherit underline=true

Evidence from debug log

SGR 4 (plain) -> underline=1 row=1 col=0
PRINT U+256D '╭' with underline=1 style=1 row=1 col=0
PRINT U+2500 '─' with underline=1 style=1 row=1 col=1
...
PRINT U+0043 'C' with underline=1 style=1 row=1 col=5   (letter 'C' in "Claude Code")
PRINT U+006C 'l' with underline=1 style=1 row=1 col=6
...

1,318 characters printed with underline=1, zero SGR 24 or SGR 0 events to clear it.

Expected Behavior

Claude Code should send SGR 24 (underline off) or SGR 0 (reset) after drawing elements that intentionally use underline, so that subsequent text does not inherit the underline attribute.

Environment

  • Terminal: Custom Qt6 terminal emulator (also tested in Konsole where underlines are invisible due to positioning but still present in cell data)
  • Claude Code: v2.1.101
  • OS: openSUSE Tumbleweed
  • TERM: xterm-256color

extent analysis

TL;DR

Send SGR 24 or SGR 0 after drawing underlined elements to reset the underline attribute.

Guidance

  • Identify all instances where SGR 4 is set to enable underlining and ensure that SGR 24 or SGR 0 is sent afterwards to clear the underline attribute.
  • Review the TUI rendering code to determine why the underline attribute is not being reset after use.
  • Test the fix in multiple terminal emulators to verify that the underline attribute is correctly reset.
  • Consider adding debug logging to track SGR events and verify that the underline attribute is being correctly set and cleared.

Example

# Example of setting and clearing underline attribute
print("\x1b[4mUnderlined text\x1b[

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

claude-code - 💡(How to fix) Fix Claude Code sets SGR 4 (underline) globally, never clears it — causes visual artifacts in terminals [1 participants]