[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 08dd58b 003/399: ivy.el (ivy--regex-fuzzy): Don't allow ne
From: |
Oleh Krehel |
Subject: |
[elpa] master 08dd58b 003/399: ivy.el (ivy--regex-fuzzy): Don't allow newlines in wildcards |
Date: |
Sat, 20 Jul 2019 14:56:36 -0400 (EDT) |
branch: master
commit 08dd58b2c6204697cf792419c0ef4ea7ca9fbc41
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
ivy.el (ivy--regex-fuzzy): Don't allow newlines in wildcards
ag (the Silver Searcher) suffers from this:
ag --nocolor --nogroup \(b\)[^a]*\(a\)[^c]*\(c\)[^k]*\(k\)
This will produce way too many matches, because e.g. ag thinks [^a]
should also match newlines, which means that we can get "b" on one
line, "a" on the second and so on.
* ivy-test.el (ivy--regex-fuzzy): Update test.
Fixes #1907
---
ivy-test.el | 8 ++++----
ivy.el | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/ivy-test.el b/ivy-test.el
index 7fc34be..12c1077 100644
--- a/ivy-test.el
+++ b/ivy-test.el
@@ -253,13 +253,13 @@ will bring the behavior in line with the newer Emacsen."
(ert-deftest ivy--regex-fuzzy ()
(should (string= (ivy--regex-fuzzy "tmux")
- "\\(t\\)[^m]*\\(m\\)[^u]*\\(u\\)[^x]*\\(x\\)"))
+ "\\(t\\)[^m\n]*\\(m\\)[^u\n]*\\(u\\)[^x\n]*\\(x\\)"))
(should (string= (ivy--regex-fuzzy ".tmux")
-
"\\(\\.\\)[^t]*\\(t\\)[^m]*\\(m\\)[^u]*\\(u\\)[^x]*\\(x\\)"))
+
"\\(\\.\\)[^t\n]*\\(t\\)[^m\n]*\\(m\\)[^u\n]*\\(u\\)[^x\n]*\\(x\\)"))
(should (string= (ivy--regex-fuzzy "^tmux")
- "^\\(t\\)[^m]*\\(m\\)[^u]*\\(u\\)[^x]*\\(x\\)"))
+ "^\\(t\\)[^m\n]*\\(m\\)[^u\n]*\\(u\\)[^x\n]*\\(x\\)"))
(should (string= (ivy--regex-fuzzy "^tmux$")
- "^\\(t\\)[^m]*\\(m\\)[^u]*\\(u\\)[^x]*\\(x\\)$"))
+ "^\\(t\\)[^m\n]*\\(m\\)[^u\n]*\\(u\\)[^x\n]*\\(x\\)$"))
(should (string= (ivy--regex-fuzzy "")
""))
(should (string= (ivy--regex-fuzzy "^")
diff --git a/ivy.el b/ivy.el
index 7d833a6..669a803 100644
--- a/ivy.el
+++ b/ivy.el
@@ -2558,7 +2558,7 @@ Insert .* between each char."
(apply #'concat
(cl-mapcar
#'concat
- (cons "" (cdr (mapcar (lambda (c) (format "[^%c]*"
c))
+ (cons "" (cdr (mapcar (lambda (c) (format
"[^%c\n]*" c))
lst)))
(mapcar (lambda (x) (format "\\(%s\\)"
(regexp-quote (char-to-string x))))
lst))))
- [elpa] master updated (64d03d9 -> 33689c1), Oleh Krehel, 2019/07/20
- [elpa] master b4492a3 002/399: counsel.el (counsel-git-checkout-action): Quote branch names, Oleh Krehel, 2019/07/20
- [elpa] master 100bd21 001/399: counsel.el (counsel-M-x): Optionally expand aliases, Oleh Krehel, 2019/07/20
- [elpa] master 08dd58b 003/399: ivy.el (ivy--regex-fuzzy): Don't allow newlines in wildcards,
Oleh Krehel <=
- [elpa] master 70ad031 004/399: doc/Changelog.org: Update path to CSS, Oleh Krehel, 2019/07/20
- [elpa] master 596461e 005/399: counsel.el (counsel-grep-use-swiper-p): New defcustom, Oleh Krehel, 2019/07/20
- [elpa] master 6017cc8 006/399: ivy.el (ivy-read): Keep only one action for one key, Oleh Krehel, 2019/07/20
- [elpa] master dc250bd 008/399: counsel.el (counsel-unicode-char): Don't sort every time, Oleh Krehel, 2019/07/20
- [elpa] master b000b0a 007/399: ivy.el (ivy--recompute-index): Speed up, Oleh Krehel, 2019/07/20
- [elpa] master c2eb4b5 009/399: ivy.el (ivy--kill-buffer-action): Integrate with ivy-switch-buffer-kill, Oleh Krehel, 2019/07/20
- [elpa] master f631d75 013/399: swiper.el (swiper-font-lock-exclude): Add xref--xref-buffer-mode, Oleh Krehel, 2019/07/20
- [elpa] master 3773c26 015/399: swiper.el (swiper--current-window-start): Add docstring, Oleh Krehel, 2019/07/20
- [elpa] master da85d1e 016/399: ivy.el: Require TRAMP earlier, Oleh Krehel, 2019/07/20
- [elpa] master 98b70a7 011/399: swiper.el (swiper--update-input-ivy): Don't recenter when non-graphical, Oleh Krehel, 2019/07/20