summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2020-07-03 19:45:58 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2020-07-03 19:45:58 +0900
commite0217e8c79dfa6efe50513d547cc107c6de8d6ac (patch)
tree7aa3d6a051791959f431c4997a6012fc84f953c5
parent3ab1c42266387348b6f9c5284d36a399cdd6cb69 (diff)
Ignore cursor position report
Close #2081
-rw-r--r--src/tui/light.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/tui/light.go b/src/tui/light.go
index d0c7fd61..a2a0515c 100644
--- a/src/tui/light.go
+++ b/src/tui/light.go
@@ -28,6 +28,7 @@ const (
const consoleDevice string = "/dev/tty"
var offsetRegexp *regexp.Regexp = regexp.MustCompile("(.*)\x1b\\[([0-9]+);([0-9]+)R")
+var offsetRegexpBegin *regexp.Regexp = regexp.MustCompile("^\x1b\\[[0-9]+;[0-9]+R")
func (r *LightRenderer) stderr(str string) {
r.stderrInternal(str, true)
@@ -333,6 +334,13 @@ func (r *LightRenderer) escSequence(sz *int) Event {
if len(r.buffer) < 2 {
return Event{ESC, 0, nil}
}
+
+ loc := offsetRegexpBegin.FindIndex(r.buffer)
+ if loc != nil && loc[0] == 0 {
+ *sz = loc[1]
+ return Event{Invalid, 0, nil}
+ }
+
*sz = 2
if r.buffer[1] >= 1 && r.buffer[1] <= 'z'-'a'+1 {
return Event{int(CtrlAltA + r.buffer[1] - 1), 0, nil}