diff options
author | Michael Kelley <michael.a.kelley@gmail.com> | 2018-08-07 23:43:55 -0700 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2018-08-08 15:43:55 +0900 |
commit | 423986996a2957cbd1c3975d5f7d64cffe6d946d (patch) | |
tree | f446742fe6f01a905148a457e1f887c076137a24 /src | |
parent | 1c9e7b7ea69daedfa09a1f7e3bd169ce165c1904 (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.go | 7 |
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 |