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

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

[elpa] master 4b17d9a 27/54: Fix up the "foo ! bar" matching and highlig


From: Oleh Krehel
Subject: [elpa] master 4b17d9a 27/54: Fix up the "foo ! bar" matching and highlighting
Date: Tue, 29 Sep 2015 14:09:56 +0000

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

    Fix up the "foo ! bar" matching and highlighting
    
    * ivy.el (ivy--filter): When regex returned is a list, use only the
      first string part.
    
    * swiper.el (swiper--update-input-ivy): When regex returned is a list,
      use only the first string part.
---
 ivy.el    |   15 ++++++++-------
 swiper.el |    3 ++-
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/ivy.el b/ivy.el
index 9a76f82..5574cd4 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1429,6 +1429,7 @@ all of the text contained in the minibuffer."
   "Return all items that match NAME in CANDIDATES.
 CANDIDATES are assumed to be static."
   (let* ((re (funcall ivy--regex-function name))
+         (re-str (if (listp re) (caar re) re))
          (matcher (ivy-state-matcher ivy-last))
          (case-fold-search (string= name (downcase name)))
          (cands (cond
@@ -1469,17 +1470,17 @@ CANDIDATES are assumed to be static."
          (tail (nthcdr ivy--index ivy--old-cands))
          idx)
     (when (and tail ivy--old-cands (not (equal "^" ivy--old-re)))
-      (unless (and (not (equal re ivy--old-re))
+      (unless (and (not (equal re-str ivy--old-re))
                    (or (setq ivy--index
                              (or
-                              (cl-position (if (and (> (length re) 0)
-                                                    (eq ?^ (aref re 0)))
-                                               (substring re 1)
-                                             re) cands
+                              (cl-position (if (and (> (length re-str) 0)
+                                                    (eq ?^ (aref re-str 0)))
+                                               (substring re-str 1)
+                                             re-str) cands
                                              :test #'equal)
                               (and ivy--directory
                                    (cl-position
-                                    (concat re "/") cands
+                                    (concat re-str "/") cands
                                     :test #'equal))))))
         (while (and tail (null idx))
           ;; Compare with eq to handle equal duplicates in cands
@@ -1490,7 +1491,7 @@ CANDIDATES are assumed to be static."
             (or (cl-position (ivy-state-preselect ivy-last)
                              cands :test #'equal)
                 ivy--index)))
-    (setq ivy--old-re (if cands re ""))
+    (setq ivy--old-re (if cands re-str ""))
     (setq ivy--old-cands cands)))
 
 (defvar ivy-format-function 'ivy-format-function-default
diff --git a/swiper.el b/swiper.el
index 7535253..ac1b0cc 100644
--- a/swiper.el
+++ b/swiper.el
@@ -309,7 +309,8 @@ Please remove it and update the \"swiper\" package."))
   "Called when `ivy' input is updated."
   (with-ivy-window
     (swiper--cleanup)
-    (let* ((re (ivy--regex ivy-text))
+    (let* ((re (funcall ivy--regex-function ivy-text))
+           (re (if (stringp re) re (caar re)))
            (str ivy--current)
            (num (if (string-match "^[0-9]+" str)
                     (string-to-number (match-string 0 str))



reply via email to

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