on main help sign in
fix(diffview): escape content to avoid surprises
commit90d1e2f15927fa335f3b773fb6a4db90ae3d0a7a authorAndrey Nering <andreynering@users.noreply.github.com> dateWed 23 Jul 2025, 14:39 (1 year ago) parente6186c6
1 file changed+2
internal/tui/exp/diffview/chroma.go+2
internal/tui/exp/diffview/chroma.go+2
@@ -7,6 +7,7 @@ import (
77 "strings"
88
99 "github.com/alecthomas/chroma/v2"
10+ "github.com/charmbracelet/crush/internal/ansiext"
1011 "github.com/charmbracelet/lipgloss/v2"
1112)
1213
@@ -22,6 +23,7 @@ type chromaFormatter struct {
2223func (c chromaFormatter) Format(w io.Writer, style *chroma.Style, it chroma.Iterator) error {
2324 for token := it(); token != chroma.EOF; token = it() {
2425 value := strings.TrimSuffix(token.Value, "\n")
26+ value = ansiext.Escape(value)
2527
2628 entry := style.Get(token.Type)
2729 if entry.IsZero() {