[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master f30c6e1 022/184: swiper.el: Fix overlay faces using regex-
From: |
Oleh Krehel |
Subject: |
[elpa] master f30c6e1 022/184: swiper.el: Fix overlay faces using regex-ignore-order |
Date: |
Wed, 16 Oct 2019 13:14:41 -0400 (EDT) |
branch: master
commit f30c6e19919e2b042b3d924c8e4fa0b80ceedc31
Author: Muir Manders <address@hidden>
Commit: Oleh Krehel <address@hidden>
swiper.el: Fix overlay faces using regex-ignore-order
regex-ignore-order operates using a list of
regexps. swiper--update-input-ivy loops over each regexp, but
when swiper--add-properties is called we have forgotten which regexp
we are adding the overlay for, so it uses the first match face for all
matches. Now we pass along a "re-idx" argument that indicates the
index of the regexp being considered. swiper--add-properties gained
logic to choose the face corresponding to this index.
Fixes #2162
---
swiper.el | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/swiper.el b/swiper.el
index 129083d..02fc34f 100644
--- a/swiper.el
+++ b/swiper.el
@@ -898,8 +898,10 @@ the face, window and priority of the overlay."
(with-ivy-window
(swiper--cleanup)
(when (> (length (ivy-state-current ivy-last)) 0)
- (let ((regexps (swiper--positive-regexps ivy-text)))
+ (let ((regexps (swiper--positive-regexps ivy-text))
+ (re-idx -1))
(dolist (re regexps)
+ (setq re-idx (1+ re-idx))
(let* ((re (replace-regexp-in-string
" " "\t"
re))
@@ -945,9 +947,11 @@ the face, window and priority of the overlay."
(if (swiper--recenter-p)
(window-end (selected-window) t)
(line-end-position (window-height)))
- swiper--point-max))))))))
+ swiper--point-max)
+ nil
+ re-idx)))))))
-(defun swiper--add-overlays (re &optional beg end wnd)
+(defun swiper--add-overlays (re &optional beg end wnd re-idx)
"Add overlays for RE regexp in visible part of the current buffer.
BEG and END, when specified, are the point bounds.
WND, when specified is the window."
@@ -988,16 +992,16 @@ WND, when specified is the window."
(buffer-substring-no-properties
(line-beginning-position)
(line-end-position)))))))
- (swiper--add-properties faces adder-fn)))))))))
+ (swiper--add-properties faces adder-fn re-idx)))))))))
-(defun swiper--add-properties (faces adder-fn)
+(defun swiper--add-properties (faces adder-fn &optional re-idx)
(let ((mb (match-beginning 0))
(me (match-end 0)))
(unless (> (- me mb) 2017)
(funcall adder-fn
mb me
(if (zerop ivy--subexps)
- (cadr faces)
+ (nth (1+ (mod (or re-idx 0) (1- (length faces)))) faces)
(car faces))
0)))
(let ((i 1)
- [elpa] master 9592cba 101/184: ivy-hydra.el: Use ivy-read-action-by-key in hydra-ivy, (continued)
- [elpa] master 9592cba 101/184: ivy-hydra.el: Use ivy-read-action-by-key in hydra-ivy, Oleh Krehel, 2019/10/16
- [elpa] master 79333e9 099/184: counsel.el (counsel-fonts): Add, Oleh Krehel, 2019/10/16
- [elpa] master 89deb75 096/184: counsel.el (counsel-rg): When in dired, operate on marked files, Oleh Krehel, 2019/10/16
- [elpa] master 4cddec4 102/184: Respect counsel-describe-function-function from counsel-M-x, Oleh Krehel, 2019/10/16
- [elpa] master 42fedf5 116/184: counsel.el (counsel-file-stale-p): Extract, Oleh Krehel, 2019/10/16
- [elpa] master 0895c1a 113/184: Add key binding to allow switching directory in counsel-git-grep, Oleh Krehel, 2019/10/16
- [elpa] master d27eb38 119/184: counsel.el (counsel-git-grep): Change args order so counsel-cd works, Oleh Krehel, 2019/10/16
- [elpa] master 582c9d4 014/184: swiper.el (swiper--candidates): Don't store line number as a string, Oleh Krehel, 2019/10/16
- [elpa] master 4a44c9e 018/184: counsel.el (counsel--async-last-error-string): Add for ease of debugging, Oleh Krehel, 2019/10/16
- [elpa] master 5e79f16 020/184: ivy.el (ivy--input): Fix point moving in TRAMP sessions, Oleh Krehel, 2019/10/16
- [elpa] master f30c6e1 022/184: swiper.el: Fix overlay faces using regex-ignore-order,
Oleh Krehel <=
- [elpa] master 9c4cdb7 025/184: swiper.el (swiper-isearch-action): Fix for ivy-occur, Oleh Krehel, 2019/10/16
- [elpa] master ed1ba4e 028/184: Makefile (deps): Add target, Oleh Krehel, 2019/10/16
- [elpa] master b5e869e 026/184: swiper.el (swiper--occur-cands): Fix wgrep, Oleh Krehel, 2019/10/16
- [elpa] master 6928beb 031/184: ivy-test.el (ivy-read-file-name-in-buffer-visiting-file): Passes, Oleh Krehel, 2019/10/16
- [elpa] master 35415e3 027/184: ivy-test.el (ivy-swiper-wgrep): Add test, Oleh Krehel, 2019/10/16
- [elpa] master fb78c3f 045/184: swiper.el: Run ispell-comments-and-strings, Oleh Krehel, 2019/10/16
- [elpa] master ae3576a 037/184: swiper.el (swiper-isearch): Fix scroll on RET, Oleh Krehel, 2019/10/16
- [elpa] master c4e0b0b 032/184: ivy-test.el (ivy-read-file-name-make-directory): Add, Oleh Krehel, 2019/10/16
- [elpa] master fdd2178 042/184: ivy.el (ivy--magic-tilde-directory): Use "~~" to move to local home, Oleh Krehel, 2019/10/16
- [elpa] master a9196a2 035/184: counsel.el (counsel-file-jump-args): Is now a list, Oleh Krehel, 2019/10/16