Skip to content
Myr

Suppress CSI codes in the output

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Junegunn Choi · committed by Junegunn Choi · parent bd9c46e · Browse files · 1 file+6 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+6 added−2 removed

  • other:+6 added−2 removed

1 file+6 added−2 removed

modified:src/tui/light.go+6 added-2 removed
746 unmodified lines
747func (w *LightWindow) Print(text string) {748 w.cprint2(colDefault, w.bg, AttrRegular, text)749}750751func cleanse(str string) string {752 return strings.Replace(str, "\x1b", "?", -1)753}754755func (w *LightWindow) CPrint(pair ColorPair, attr Attr, text string) {756 if !w.colored {757 w.csiColor(colDefault, colDefault, attrFor(pair, attr))758 } else {759 w.csiColor(pair.Fg(), pair.Bg(), attr)760 }757 w.stderrInternal(text, false)761 w.stderrInternal(cleanse(text), false)762 w.csi("m")763}764765func (w *LightWindow) cprint2(fg Color, bg Color, attr Attr, text string) {766 if w.csiColor(fg, bg, attr) {767 defer w.csi("m")768 }765 w.stderrInternal(text, false)769 w.stderrInternal(cleanse(text), false)770}771772type wrappedLine struct {773 text string
89 unmodified lines