Skip to content

Commit

Permalink
fix: properly handle missing SGR parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed Nov 4, 2024
1 parent eb7a735 commit d632863
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"strconv"

"github.com/charmbracelet/x/ansi"
"github.com/charmbracelet/x/ansi/parser"
)

// NewWriter creates a new color profile writer that downgrades color sequences
Expand Down Expand Up @@ -86,10 +85,7 @@ func handleSgr(w *Writer, p *ansi.Parser, buf *bytes.Buffer) {
param := ansi.Param(p.Params[i])

switch param := param.Param(); param {
case parser.MissingParam:
if w.Profile > Ascii {
continue
}
case -1:
// SGR default parameter is 0. We use an empty string to reduce the
// number of bytes written to the buffer.
style = append(style, "")
Expand Down

0 comments on commit d632863

Please sign in to comment.