branch: externals/ivy-hydra
commit 9e1513fda3d2340c1306f94198dc46f33dfc4da9
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
ivy.el (ivy--split): Don't split consecutive group brackets
* ivy-test.el (ivy--split): Add tests.
Fixes #2507
---
ivy-test.el | 6 +++++-
ivy.el | 5 +----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/ivy-test.el b/ivy-test.el
index ef89e61..e1b2174 100644
--- a/ivy-test.el
+++ b/ivy-test.el
@@ -264,7 +264,11 @@ will bring the behavior in line with the newer Emacsen."
"\\( -> \\)"
".*")))
(should (equal (ivy--split "[^ ]\\( -> \\).*")
- '("[^ ]" "\\( -> \\)" ".*"))))
+ '("[^ ]" "\\( -> \\)" ".*")))
+ (should (equal (ivy--split "[ab][cd]") '("[ab][cd]")))
+ (should (equal (ivy--split "[a b][c d]") '("[a b][c d]")))
+ (should (equal (ivy--split "[ab] [cd]") '("[ab]" "[cd]")))
+ (should (equal (ivy--split "[a b] [c d]") '("[a b]" "[c d]"))))
(ert-deftest ivy--regex ()
(should (equal (ivy--regex
diff --git a/ivy.el b/ivy.el
index 2a88f45..3092d5b 100644
--- a/ivy.el
+++ b/ivy.el
@@ -2811,10 +2811,7 @@ regexp is passed to `regexp-quote'."
(cond ((= ?\[ c)
(if (setq end (ivy--match-regex-brackets
(substring str i)))
- (progn
- (push (substring str start (+ i end)) res)
- (cl-incf i end)
- (setq start i))
+ (cl-incf i end)
(setq ivy--input-garbage (substring str i))
(throw 'break nil)))
((= ?\\ c)