Skip to content
Myr

Ignore VT100-related escape codes

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 0612074 · Browse files · 1 file+2 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+2 added−2 removed

  • other:+2 added−2 removed

1 file+2 added−2 removed

modified:src/ansi.go+2 added-2 removed
31 unmodified lines
3233var ansiRegex *regexp.Regexp3435func init() {36 ansiRegex = regexp.MustCompile("\x1b\\[[0-9;]*[mK]")36 ansiRegex = regexp.MustCompile("\x1b.[0-9;]*.")37}3839func extractColor(str string, state *ansiState, proc func(string, *ansiState) bool) (string, *[]ansiOffset, *ansiState) {40 var offsets []ansiOffset
56 unmodified lines
97 state = &ansiState{-1, -1, false}98 } else {99 state = &ansiState{prevState.fg, prevState.bg, prevState.bold}100 }101 if ansiCode[len(ansiCode)-1] == 'K' {101 if ansiCode[1] != '[' || ansiCode[len(ansiCode)-1] != 'm' {102 return state103 }104105 ptr := &state.fg
58 unmodified lines