]> code.delx.au - gnu-emacs-elpa/commitdiff
ivy.el (ivy--regex): Don't consider \\(?...\) a group
authorOleh Krehel <ohwoeowho@gmail.com>
Mon, 22 Feb 2016 20:18:14 +0000 (21:18 +0100)
committerOleh Krehel <ohwoeowho@gmail.com>
Mon, 22 Feb 2016 20:18:14 +0000 (21:18 +0100)
* ivy-test.el (ivy--regex): Add test.

Fixes #393

ivy-test.el
ivy.el

index 807f8ada4f2bd3f1a1d53505b8b9c739da0209a4..e857449e99e2184c79164527c20e08e7763a34e3 100644 (file)
                   "and  I  am"
                    "your  king."))))
 
+(ert-deftest ivy--regex ()
+  (should (equal (ivy--regex
+                  "\\(?:interactive\\|swiper\\) \\(?:list\\|symbol\\)")
+                 "\\(\\(?:interactive\\|swiper\\)\\).*?\\(\\(?:list\\|symbol\\)\\)")))
+
 (ert-deftest ivy--regex-fuzzy ()
   (should (string= (ivy--regex-fuzzy "tmux")
                    "\\(t\\).*\\(m\\).*\\(u\\).*\\(x\\)"))
diff --git a/ivy.el b/ivy.el
index 5630f1beba6e667a60219ca97100e7fc5309bb86..84d4af79855416a4349148824926cf129d40e825 100644 (file)
--- a/ivy.el
+++ b/ivy.el
@@ -1655,7 +1655,7 @@ When GREEDY is non-nil, join words in a greedy way."
                          (setq ivy--subexps (length subs))
                          (mapconcat
                           (lambda (x)
-                            (if (string-match "\\`\\\\(.*\\\\)\\'" x)
+                            (if (string-match "\\`\\\\([^?].*\\\\)\\'" x)
                                 x
                               (format "\\(%s\\)" x)))
                           subs