summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Kelley <michael.a.kelley@gmail.com>2018-08-07 23:43:55 -0700
committerJunegunn Choi <junegunn.c@gmail.com>2018-08-08 15:43:55 +0900
commit423986996a2957cbd1c3975d5f7d64cffe6d946d (patch)
treef446742fe6f01a905148a457e1f887c076137a24 /src
parent1c9e7b7ea69daedfa09a1f7e3bd169ce165c1904 (diff)
Handle incomplete ESC sequence in typeahead buffer (#1350)
If an ESC char is found while processing characters, continue to check for characters. This prevents fzf from prematurely exiting. Close #1349
Diffstat (limited to 'src')
-rw-r--r--src/tui/light.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/tui/light.go b/src/tui/light.go
index e223f4ab..1098d591 100644
--- a/src/tui/light.go
+++ b/src/tui/light.go
@@ -297,6 +297,7 @@ func (r *LightRenderer) getBytesInternal(buffer []byte, nonblock bool) []byte {
}
buffer = append(buffer, byte(c))
+ pc := c
for {
c, ok = r.getch(true)
if !ok {
@@ -306,9 +307,13 @@ func (r *LightRenderer) getBytesInternal(buffer []byte, nonblock bool) []byte {
continue
}
break
+ } else if c == ESC && pc != c {
+ retries = r.escDelay / escPollInterval
+ } else {
+ retries = 0
}
- retries = 0
buffer = append(buffer, byte(c))
+ pc = c
}
return buffer