Skip to content

Commit f49aae9

Browse files
committed
bdx: Minimize flicker when redisplaying the list as the user types
* bdx.el (bdx--prev-candidates): New defvar. (bdx--ivy-collection-function): Set it to the previous list of all candidates, and return it as the temporary collection until we get an update from the process.
1 parent da0577a commit f49aae9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

bdx.el

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ as a property of the string."
239239
(get-text-property 0 'bdx-data string))
240240

241241
(defvar bdx--last-process nil)
242+
(defvar bdx--prev-candidates nil)
242243
(defvar bdx--all-candidates nil)
243244
(defvar bdx--outdated-files nil)
244245
(defvar bdx--sources-needing-recompilation nil
@@ -250,6 +251,7 @@ as a property of the string."
250251
(defun bdx--ivy-collection-function (string &rest _args)
251252
"Collect candidates for query STRING.
252253
This should be used as COLLECTION for `ivy-read'."
254+
(setq bdx--prev-candidates bdx--all-candidates)
253255
(setq bdx--all-candidates nil)
254256
(setq bdx--outdated-files nil)
255257
(setq bdx--sources-needing-recompilation nil)
@@ -264,7 +266,7 @@ This should be used as COLLECTION for `ivy-read'."
264266

265267
(let ((depth (minibuffer-depth)))
266268
(or (ivy-more-chars)
267-
(prog1 '("" "working...")
269+
(prog1 bdx--prev-candidates
268270
(setq
269271
bdx--last-process
270272
(bdx--search-async
@@ -396,6 +398,7 @@ a symbol."
396398
(setq bdx--callback #'ignore)
397399
(setq bdx--done-callback #'ignore)
398400
(setq bdx--error-callback #'ignore)
401+
(setq bdx--all-candidates nil)
399402
(when (processp bdx--last-process)
400403
(delete-process bdx--last-process)
401404
(accept-process-output bdx--last-process 0.1))))))

0 commit comments

Comments
 (0)