emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master e69ddc3 295/399: ivy.el (ivy-sort-function-buffer): Unify


From: Oleh Krehel
Subject: [elpa] master e69ddc3 295/399: ivy.el (ivy-sort-function-buffer): Unify prefix and star-prefix matches
Date: Sat, 20 Jul 2019 14:57:43 -0400 (EDT)

branch: master
commit e69ddc352f667aca8a1367dcbd3124d6fe3dd807
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    ivy.el (ivy-sort-function-buffer): Unify prefix and star-prefix matches
    
    Results in a more consistent sorting behavior.
---
 ivy.el | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/ivy.el b/ivy.el
index bf7ff08..2825a9d 100644
--- a/ivy.el
+++ b/ivy.el
@@ -3261,20 +3261,22 @@ before substring matches."
           (= (aref name 0) ?^))
       candidates
     (let* ((base-re (ivy-re-to-str (funcall ivy--regex-function name)))
-           (re-prefix (concat "\\`\\*" base-re))
+           (re-star-prefix (concat "\\`\\*" base-re))
+           (re-prefix (concat "\\`" base-re))
            res-prefix
            res-noprefix
            res-virtual-prefix
            res-virtual-noprefix)
-      (unless (cl-find-if (lambda (s) (string-match-p re-prefix s)) candidates)
-        (setq re-prefix (concat "\\`" base-re)))
       (dolist (s candidates)
         (cond
-          ((and (assoc s ivy--virtual-buffers) (string-match-p re-prefix s))
+          ((and (assoc s ivy--virtual-buffers)
+                (or (string-match-p re-star-prefix s)
+                    (string-match-p re-prefix s)))
            (push s res-virtual-prefix))
           ((assoc s ivy--virtual-buffers)
            (push s res-virtual-noprefix))
-          ((string-match-p re-prefix s)
+          ((or (string-match-p re-star-prefix s)
+               (string-match-p re-prefix s))
            (push s res-prefix))
           (t
            (push s res-noprefix))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]