branch: externals/ivy-hydra
commit aef25380f3c2a8a8209af844791d8a399aaac192
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>

    ivy-test.el (ivy--split): Add test
---
 ivy-test.el |  4 +++-
 ivy.el      | 11 ++++++-----
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/ivy-test.el b/ivy-test.el
index d7f8d20..20ac232 100644
--- a/ivy-test.el
+++ b/ivy-test.el
@@ -232,7 +232,9 @@ will bring the behavior in line with the newer Emacsen."
   (should (equal (ivy--split "^[^ ] bar") '("^[^ ]" "bar")))
   (should (equal (ivy--split "defun [^ ]+") '("defun" "[^ ]+")))
   (should (equal (ivy--split "[^ ]+ -> .*")
-                 '("[^ ]+" "->" ".*"))))
+                 '("[^ ]+" "->" ".*")))
+  (should (equal (ivy--split "[^ \n]+ \\( ->\\)")
+                 '("[^ \n]+" "\\( ->\\)"))))
 
 (ert-deftest ivy--regex ()
   (should (equal (ivy--regex
diff --git a/ivy.el b/ivy.el
index 575b446..50a0757 100644
--- a/ivy.el
+++ b/ivy.el
@@ -2655,12 +2655,13 @@ regexp is passed to `regexp-quote'."
     (while (and (string-match " +" str start1)
                 (< start1 len))
       (if (and (>= (match-beginning 0) 2)
-               (string= "[^" (substring
-                              str
-                              (- (match-beginning 0) 2)
-                              (match-beginning 0))))
+               (member (substring
+                        str
+                        (- (match-beginning 0) 2)
+                        (match-beginning 0))
+                       '("[^" "\\(")))
           (progn
-            (setq start0 start1)
+            (setq start0 (or start0 start1))
             (setq start1 (match-end 0)))
         (setq match-len (- (match-end 0) (match-beginning 0)))
         (if (= match-len 1)

Reply via email to