mirror of
https://github.com/junegunn/fzf.git
synced 2026-08-25 09:03:00 +08:00
Keep a minimum wait for a sequence in flight
ESCDELAY=0 makes the retry count zero, so the wait added in d0377ed had
no effect and the reply still leaked. Past the introducer these bytes
cannot be the ESC key, so waiting for them adds no Escape latency.
- Wait at least defaultEscDelay, honour a larger ESCDELAY
- Lone ESC still honours ESCDELAY=0, measured 3ms to exit either way
Fix #4899
This commit is contained in:
+3
-1
@@ -420,8 +420,10 @@ func (r *LightRenderer) getBytesInternal(cancellable bool, buffer []byte, nonblo
|
||||
buffer = append(buffer, byte(c))
|
||||
// Keep waiting while a sequence is still arriving. Dropping the budget
|
||||
// after every byte left fzf parsing whatever the read happened to end on.
|
||||
// Past the introducer this is not the ESC key, so the wait costs no
|
||||
// Escape latency and ESCDELAY=0 must not reduce it to nothing.
|
||||
if retries == 0 && incompleteEscape(buffer) {
|
||||
retries = r.escDelay / escPollInterval
|
||||
retries = max(r.escDelay, defaultEscDelay) / escPollInterval
|
||||
}
|
||||
pc = c
|
||||
|
||||
|
||||
Reference in New Issue
Block a user