fix(ansi): pop color at the end of the text

resolves #4290
This commit is contained in:
Jan De Dobbeleer 2023-09-27 09:49:57 +02:00 committed by Jan De Dobbeleer
parent 6bfae958c4
commit 19020c10bb

View file

@ -342,7 +342,7 @@ func (w *Writer) Write(background, foreground, text string) {
// reset colors
w.writeEscapedAnsiString(resetStyle.End)
// reset current
// pop last color from the stack
w.current.Pop()
}
@ -487,6 +487,7 @@ func (w *Writer) endColorOverride(position int) int {
// do not restore colors at the end of the string, we print it anyways
if position == len(w.runes)-1 {
w.current.Pop()
return position
}