Skip to content

fix: keep tabs in text values and treat CRLF as newlines - #229

Closed
00200200 wants to merge 1 commit into
charmbracelet:mainfrom
00200200:fix-preserve-tabs-in-text-values
Closed

00200200 wants to merge 1 commit into
charmbracelet:mainfrom
00200200:fix-preserve-tabs-in-text-values

Conversation

@00200200

Copy link
Copy Markdown

Summary

  • Fixes Error logging with Oops: \t not printed correctly聽#144: tab characters in text log values (pretty-printed errors, source fragments) were escaped as \t and then expanded or dropped by Lip Gloss, so indentation disappeared.
  • Carriage returns in those same strings (\r\n / leftover \r) are treated as line breaks instead of a literal \r.
  • Multiline values are still styled, but with lipgloss.NoTabConversion so a tab stays a tab.

Test plan

  • go test -count=1 -run TestTextLogger/multiline_value_preserves_tabs . failed on main (\\tline) and passes with this change
  • go test -count=1 -run TestTextLogger/multiline_value_treats_CRLF_as_a_line_break . failed on main (src:\\r) and passes with this change
  • go test -count=1 . passes

Pretty-printed errors (for example oops stack fragments) indent with
tabs and often use Windows newlines. The text formatter escaped both,
and Lip Gloss then turned remaining tabs into spaces, so the source
never lined up. Leave tabs intact and normalize CR before wrapping
multiline values.
@00200200 00200200 closed this Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error logging with Oops: \t not printed correctly

1 participant