branch: externals/ivy-hydra
commit 1b3d0a33418766c76bc9aab982037a79ec624257
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
ivy.el (ivy--split): Fix for "\\" input
* ivy-test.el (ivy--regex): Add test.
Fixes #2343
---
ivy-test.el | 3 ++-
ivy.el | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/ivy-test.el b/ivy-test.el
index 5e10fe0..97e46a4 100644
--- a/ivy-test.el
+++ b/ivy-test.el
@@ -266,7 +266,8 @@ will bring the behavior in line with the newer Emacsen."
(should (equal (ivy--regex "[^ \n]+\\( -> \\).*")
"\\([^ \n]+\\)\\( -> \\).*?\\(.*\\)"))
(should (equal (ivy--regex "\\([^ \\n]+\\)\\( -> \\).*")
- "\\([^ \\n]+\\)\\( -> \\).*?\\(.*\\)")))
+ "\\([^ \\n]+\\)\\( -> \\).*?\\(.*\\)"))
+ (should (equal (ivy--regex "\\\\") "\\\\")))
(ert-deftest ivy--split-negation ()
(should (equal (ivy--split-negation "") ()))
diff --git a/ivy.el b/ivy.el
index d8e4083..e9de309 100644
--- a/ivy.el
+++ b/ivy.el
@@ -2687,7 +2687,7 @@ regexp is passed to `regexp-quote'."
(setq ivy--input-garbage (substring str i))
(throw 'break nil)))
((= ?\\ c)
- (if (= ?\( (aref str (1+ i)))
+ (if (and (< (1+ i) len) (= ?\( (aref str (1+ i))))
(progn
(when (> i start)
(push (substring str start i) res))