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
pull/1086/merge
Michael Kelley 6 years ago committed by Junegunn Choi
parent 1c9e7b7ea6
commit 423986996a

@ -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

Loading…
Cancel
Save