ANSI parser now also handles SGR 39 and 49. Fixes #347
This commit is contained in:
parent
2941d561fb
commit
a5d5a39c38
2 changed files with 8 additions and 4 deletions
4
ansi.go
4
ansi.go
|
@ -146,12 +146,12 @@ func (a *ansi) Write(text []byte) (int, error) {
|
|||
colorNumber, _ := strconv.Atoi(field)
|
||||
foreground = lookupColor(colorNumber-30, false)
|
||||
case "39":
|
||||
foreground = "default"
|
||||
foreground = "-"
|
||||
case "40", "41", "42", "43", "44", "45", "46", "47":
|
||||
colorNumber, _ := strconv.Atoi(field)
|
||||
background = lookupColor(colorNumber-40, false)
|
||||
case "49":
|
||||
background = "default"
|
||||
background = "-"
|
||||
case "90", "91", "92", "93", "94", "95", "96", "97":
|
||||
colorNumber, _ := strconv.Atoi(field)
|
||||
foreground = lookupColor(colorNumber-90, true)
|
||||
|
|
8
util.go
8
util.go
|
@ -125,8 +125,12 @@ func overlayStyle(background tcell.Color, defaultStyle tcell.Style, fgColor, bgC
|
|||
style := defaultStyle.Background(background)
|
||||
|
||||
style = style.Foreground(defFg)
|
||||
if fgColor != "" && fgColor != "-" {
|
||||
style = style.Foreground(tcell.GetColor(fgColor))
|
||||
if fgColor != "" {
|
||||
if fgColor == "-" {
|
||||
style = style.Foreground(defFg)
|
||||
} else {
|
||||
style = style.Foreground(tcell.GetColor(fgColor))
|
||||
}
|
||||
}
|
||||
|
||||
if bgColor == "-" || bgColor == "" && defBg != tcell.ColorDefault {
|
||||
|
|
Loading…
Reference in a new issue