summaryrefslogtreecommitdiffstats
path: root/src/ansi.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2015-03-27 12:35:06 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2015-03-27 12:35:06 +0900
commitce7d4a1c53ef73ad4f02726f6ccf1df1d6a3eb1c (patch)
tree23fd13e71c348f51af7e7aabcad5b3739e2fdffc /src/ansi.go
parent9bba6bd172a0c56b4dfe346d6cd34f94d0b27cde (diff)
Fix #162 - Ignore \e[K
Diffstat (limited to 'src/ansi.go')
-rw-r--r--src/ansi.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ansi.go b/src/ansi.go
index f4c8f5a0..126a9920 100644
--- a/src/ansi.go
+++ b/src/ansi.go
@@ -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