From 19020c10bbdd987a3242efeb20a41c3970602b8b Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Wed, 27 Sep 2023 09:49:57 +0200 Subject: [PATCH] fix(ansi): pop color at the end of the text resolves #4290 --- src/ansi/ansi_writer.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ansi/ansi_writer.go b/src/ansi/ansi_writer.go index 1d89830f..eb2f0181 100644 --- a/src/ansi/ansi_writer.go +++ b/src/ansi/ansi_writer.go @@ -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 }