diff --git a/src/ansi_color.go b/src/ansi_color.go index ca7dec1ae206..f01320ff73a2 100644 --- a/src/ansi_color.go +++ b/src/ansi_color.go @@ -92,6 +92,10 @@ func (a *AnsiColor) getAnsiFromColorString(colorString string, isBackground bool } func (a *AnsiColor) writeColoredText(background, foreground, text string) { + // Avoid emitting empty strings with color codes + if text == "" { + return + } var coloredText string if foreground == Transparent && background != "" { ansiColor := a.getAnsiFromColorString(background, false)