@@ -7,6 +7,7 @@ import (
9 "github.com/alecthomas/chroma/v2"
9 "github.com/alecthomas/chroma/v2"
10+ "github.com/charmbracelet/crush/internal/ansiext"
10 "github.com/charmbracelet/lipgloss/v2"
11 "github.com/charmbracelet/lipgloss/v2"
@@ -22,6 +23,7 @@ type chromaFormatter struct {
22func (c chromaFormatter) Format(w io.Writer, style *chroma.Style, it chroma.Iterator) error {
23func (c chromaFormatter) Format(w io.Writer, style *chroma.Style, it chroma.Iterator) error {
23 for token := it(); token != chroma.EOF; token = it() {
24 for token := it(); token != chroma.EOF; token = it() {
24 value := strings.TrimSuffix(token.Value, "\n")
25 value := strings.TrimSuffix(token.Value, "\n")
26+ value = ansiext.Escape(value)
26 entry := style.Get(token.Type)
28 entry := style.Get(token.Type)
27 if entry.IsZero() {
29 if entry.IsZero() {