summaryrefslogtreecommitdiff
path: root/corfu.el
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2023-12-23 12:00:17 +0100
committerDaniel Mendler <mail@daniel-mendler.de>2023-12-23 12:00:17 +0100
commit8167301b61ff479d34cb3e069154cfa119ed3b44 (patch)
tree8a89dcae85cb81c1a0b83f299c22825bb4df6b51 /corfu.el
parent9cebcfedca0ab165fcfc8a56acc2d2513a02b9e3 (diff)
corfu--move-to-front: Handle duplicates
Diffstat (limited to 'corfu.el')
-rw-r--r--corfu.el8
1 files changed, 5 insertions, 3 deletions
diff --git a/corfu.el b/corfu.el
index a0cd407..3df9e07 100644
--- a/corfu.el
+++ b/corfu.el
@@ -518,9 +518,11 @@ FRAME is the existing frame."
(defun corfu--move-to-front (elem list)
"Move ELEM to front of LIST."
- (if-let ((found (member elem list)))
- (nconc (list (car found)) (delq (setcar found nil) list))
- list))
+ ;; In contrast to Vertico, this function handles duplicates. See also the
+ ;; special deduplication function `corfu--delete-dups' based on
+ ;; `equal-including-properties'
+ (nconc (cl-loop for x in list if (equal x elem) collect x)
+ (delete elem list)))
(defun corfu--filter-completions (&rest args)
"Compute all completions for ARGS with lazy highlighting."