Keep a minimum wait for a sequence in flight
CodeQL / Analyze (go) (push) Waiting to run
build / build (push) Waiting to run
Test fzf on macOS / build (push) Waiting to run

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:
Junegunn Choi
2026-08-24 09:54:09 +09:00
parent d0377ed4dc
commit d46bfd005a
+3 -1
View File
@@ -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