mirror of
				https://github.com/charmbracelet/crush.git
				synced 2025-08-02 05:20:46 +03:00 
			
		
		
		
	fix(diffview): escape content to avoid surprises
This commit is contained in:
		| @@ -7,6 +7,7 @@ import ( | ||||
| 	"strings" | ||||
|  | ||||
| 	"github.com/alecthomas/chroma/v2" | ||||
| 	"github.com/charmbracelet/crush/internal/ansiext" | ||||
| 	"github.com/charmbracelet/lipgloss/v2" | ||||
| ) | ||||
|  | ||||
| @@ -22,6 +23,7 @@ type chromaFormatter struct { | ||||
| func (c chromaFormatter) Format(w io.Writer, style *chroma.Style, it chroma.Iterator) error { | ||||
| 	for token := it(); token != chroma.EOF; token = it() { | ||||
| 		value := strings.TrimSuffix(token.Value, "\n") | ||||
| 		value = ansiext.Escape(value) | ||||
|  | ||||
| 		entry := style.Get(token.Type) | ||||
| 		if entry.IsZero() { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Andrey Nering
					Andrey Nering