Skip to content

Commit e31a8fd

Browse files
committed
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.
1 parent 1c6b3da commit e31a8fd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ivy.el

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3299,22 +3299,25 @@ Otherwise, ~/ will move home."
32993299
"Delay in ms before dynamic collections are refreshed"
33003300
:type 'integer)
33013301

3302+
(defvar ivy--queue-last-input nil)
33023303
(defvar ivy--exhibit-timer nil)
33033304

33043305
(defun ivy--queue-exhibit ()
33053306
"Insert Ivy completions display, possibly after a timeout for
33063307
dynamic collections.
33073308
Should be run via minibuffer `post-command-hook'."
33083309
(if (and (> ivy-dynamic-exhibit-delay-ms 0)
3309-
(ivy-state-dynamic-collection ivy-last))
3310+
(ivy-state-dynamic-collection ivy-last)
3311+
(not (equal ivy--queue-last-input (ivy--input))))
33103312
(progn
33113313
(when ivy--exhibit-timer (cancel-timer ivy--exhibit-timer))
33123314
(setq ivy--exhibit-timer
33133315
(run-with-timer
33143316
(/ ivy-dynamic-exhibit-delay-ms 1000.0)
33153317
nil
33163318
'ivy--exhibit)))
3317-
(ivy--exhibit)))
3319+
(ivy--exhibit))
3320+
(setq ivy--queue-last-input (ivy--input)))
33183321

33193322
(defalias 'ivy--file-local-name
33203323
(if (fboundp 'file-local-name)

0 commit comments

Comments
 (0)