mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-28 04:19:41 -08:00
fix: avoid emitting empty ansi color codes
When there's no color override an empty string is emitted. The fix reduces the emitted output by 40% approximatively with the default theme(1604 -> 1138).
This commit is contained in:
parent
077b839a9d
commit
969b54420a
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue