summaryrefslogtreecommitdiffstats
path: root/src
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
parent9bba6bd172a0c56b4dfe346d6cd34f94d0b27cde (diff)
Fix #162 - Ignore \e[K
Diffstat (limited to 'src')
-rw-r--r--src/Makefile2
-rw-r--r--src/ansi.go5
-rw-r--r--src/ansi_test.go8
-rw-r--r--src/constants.go2
4 files changed, 14 insertions, 3 deletions
diff --git a/src/Makefile b/src/Makefile
index 2604c3ba..d833ce98 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -18,7 +18,7 @@ BINDIR := ../bin
BINARY32 := fzf-$(GOOS)_386
BINARY64 := fzf-$(GOOS)_amd64
-VERSION = $(shell fzf/$(BINARY64) --version)
+VERSION = $(shell fzf/$(BINARY64) --version | sed 's/-p[0-9]*//')
RELEASE32 = fzf-$(VERSION)-$(GOOS)_386
RELEASE64 = fzf-$(VERSION)-$(GOOS)_amd64
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
diff --git a/src/ansi_test.go b/src/ansi_test.go
index be982eb4..9f628409 100644
--- a/src/ansi_test.go
+++ b/src/ansi_test.go
@@ -53,6 +53,14 @@ func TestExtractColor(t *testing.T) {
assert(offsets[0], 0, 6, -1, -1, true)
})
+ src = "\x1b[1mhello \x1b[Kworld"
+ check(func(offsets []ansiOffset) {
+ if len(offsets) != 1 {
+ t.Fail()
+ }
+ assert(offsets[0], 0, 11, -1, -1, true)
+ })
+
src = "hello \x1b[34;45;1mworld"
check(func(offsets []ansiOffset) {
if len(offsets) != 1 {
diff --git a/src/constants.go b/src/constants.go
index 729bc5c4..394a40d8 100644
--- a/src/constants.go
+++ b/src/constants.go
@@ -5,7 +5,7 @@ import (
)
// Current version
-const Version = "0.9.5"
+const Version = "0.9.5-p1"
// fzf events
const (