summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2024-02-25 17:44:46 +0100
committerDaniel Mendler <mail@daniel-mendler.de>2024-02-25 17:44:46 +0100
commit888b4525361c4050f35f4766fe7651c97d3274ce (patch)
tree12e46410bb4185b0dad60fc5ce19ecda062f9758
parent85ff35a051134e696acd2e5d17291fc37f8a8335 (diff)
consult--async-throttle: Better computation of the throttle delay
-rw-r--r--consult.el4
1 files changed, 2 insertions, 2 deletions
diff --git a/consult.el b/consult.el
index 7d9aee4..a4caafb 100644
--- a/consult.el
+++ b/consult.el
@@ -2302,7 +2302,7 @@ The THROTTLE delay defaults to `consult-async-input-throttle'.
The DEBOUNCE delay defaults to `consult-async-input-debounce'."
(setq throttle (or throttle consult-async-input-throttle)
debounce (or debounce consult-async-input-debounce))
- (let* ((input "") (timer (timer-create)) last)
+ (let* ((input "") (timer (timer-create)) (last 0))
(lambda (action)
(pcase action
((pred stringp)
@@ -2317,7 +2317,7 @@ The DEBOUNCE delay defaults to `consult-async-input-debounce'."
(timer-set-time
timer
(timer-relative-time
- nil (max debounce (if last (min (- (float-time) last) throttle) 0))))
+ nil (max debounce (- (+ last throttle) (float-time)))))
(timer-activate timer)))
nil)
('destroy