From 8aa747ffc9c5c35e6304f850dc5fc98101438973 Mon Sep 17 00:00:00 2001 From: Umar Ahmad Date: Sat, 18 Dec 2021 23:34:14 +0530 Subject: [PATCH] Only enable dynamic exhibit delay while typing Fixes #1218 Adds an extra check to `ivy--queue-exhibit` to only debounce if the input has actually changed. It also maintains the previous input variable to match against. --- ivy.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ivy.el b/ivy.el index 01fc4bc4..363b4643 100644 --- a/ivy.el +++ b/ivy.el @@ -3344,6 +3344,7 @@ Otherwise, ~/ will move home." "Delay in ms before dynamic collections are refreshed" :type 'integer) +(defvar ivy--queue-last-input nil) (defvar ivy--exhibit-timer nil) (defun ivy--queue-exhibit () @@ -3351,7 +3352,8 @@ Otherwise, ~/ will move home." dynamic collections. Should be run via minibuffer `post-command-hook'." (if (and (> ivy-dynamic-exhibit-delay-ms 0) - (ivy-state-dynamic-collection ivy-last)) + (ivy-state-dynamic-collection ivy-last) + (not (equal ivy--queue-last-input (ivy--input)))) (progn (when ivy--exhibit-timer (cancel-timer ivy--exhibit-timer)) (setq ivy--exhibit-timer @@ -3359,7 +3361,8 @@ Should be run via minibuffer `post-command-hook'." (/ ivy-dynamic-exhibit-delay-ms 1000.0) nil 'ivy--exhibit))) - (ivy--exhibit))) + (ivy--exhibit)) + (setq ivy--queue-last-input (ivy--input))) (defalias 'ivy--file-local-name (if (fboundp 'file-local-name)