Fix #162 - Ignore \e[K

This commit is contained in:
Junegunn Choi
2015-03-27 12:35:06 +09:00
parent 9bba6bd172
commit ce7d4a1c53
4 changed files with 14 additions and 3 deletions

View File

@@ -33,7 +33,7 @@ func (s *ansiState) equals(t *ansiState) bool {
var ansiRegex *regexp.Regexp
func init() {
ansiRegex = regexp.MustCompile("\x1b\\[[0-9;]*m")
ansiRegex = regexp.MustCompile("\x1b\\[[0-9;]*[mK]")
}
func extractColor(str *string) (*string, []ansiOffset) {
@@ -87,6 +87,9 @@ func interpretCode(ansiCode string, prevState *ansiState) *ansiState {
} else {
state = &ansiState{prevState.fg, prevState.bg, prevState.bold}
}
if ansiCode[len(ansiCode)-1] == 'K' {
return state
}
ptr := &state.fg
state256 := 0