[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 7dc1445 256/399: swiper.el (swiper-isearch): Use the same
From: |
Oleh Krehel |
Subject: |
[elpa] master 7dc1445 256/399: swiper.el (swiper-isearch): Use the same faces in the minibuffer |
Date: |
Sat, 20 Jul 2019 14:57:35 -0400 (EDT) |
branch: master
commit 7dc14452de5888ff6d6e703121242b7c71c83679
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
swiper.el (swiper-isearch): Use the same faces in the minibuffer
* swiper.el (swiper--isearch-highlight): Add.
(swiper--isearch-format): Update.
---
swiper.el | 27 ++++++++++++++++++++-------
1 file changed, 20 insertions(+), 7 deletions(-)
diff --git a/swiper.el b/swiper.el
index ea2d913..d0dc480 100644
--- a/swiper.el
+++ b/swiper.el
@@ -1354,6 +1354,21 @@ When not running `swiper-isearch' already, start it."
(put-text-property 0 1 'point pt s)
s)))
+(defun swiper--isearch-highlight (str &optional current)
+ (let ((start 0)
+ (i 0))
+ (while (string-match ivy--old-re str start)
+ (setq start (match-end 0))
+ (swiper--add-properties
+ (if (eq current i)
+ swiper-faces
+ swiper-background-faces)
+ (lambda (beg end face _priority)
+ (ivy-add-face-text-property
+ beg end face str)))
+ (cl-incf i))
+ str))
+
(defun swiper--isearch-format (index length cands regex current buffer)
(let* ((half-height (/ ivy-height 2))
(i (1- index))
@@ -1371,22 +1386,20 @@ When not running `swiper-isearch' already, start it."
(< len half-height))
(setq s (swiper--line-at-point (nth i cands)))
(unless (swiper--isearch-same-line-p s (car res))
- (push (ivy--format-minibuffer-line s) res)
+ (push (swiper--isearch-highlight s) res)
(cl-incf len))
(cl-decf i))
(setq res (nreverse res))
(let ((current-str
(ivy--add-face
- (ivy--format-minibuffer-line
+ (swiper--isearch-highlight
(swiper--line-at-point current))
- 'ivy-current-match))
+ 'swiper-line-face))
(start 0))
(dotimes (_ (1+ j))
(string-match regex current-str start)
(setq start (match-end 0)))
- (ivy-add-face-text-property
- (match-beginning 0) (match-end 0)
- 'swiper-isearch-current-match current-str)
+ (swiper--isearch-highlight current-str j)
(push current-str res))
(cl-incf len)
(setq i (1+ index))
@@ -1399,7 +1412,7 @@ When not running `swiper-isearch' already, start it."
(< len ivy-height))
(setq s (swiper--line-at-point (nth i cands)))
(unless (swiper--isearch-same-line-p s (car res))
- (push (ivy--format-minibuffer-line s) res)
+ (push (swiper--isearch-highlight s) res)
(cl-incf len))
(cl-incf i))
(mapconcat #'identity (nreverse res) "\n"))))
- [elpa] master b7574fe 234/399: swiper.el: Extra condition to recenter in terminal, (continued)
- [elpa] master b7574fe 234/399: swiper.el: Extra condition to recenter in terminal, Oleh Krehel, 2019/07/20
- [elpa] master 10755b2 239/399: swiper.el (swiper-isearch-toggle): Add, Oleh Krehel, 2019/07/20
- [elpa] master 38f8e45 242/399: swiper.el (swiper-isearch-toggle): Fix candidate jump in toggle, Oleh Krehel, 2019/07/20
- [elpa] master d9d6064 241/399: ivy.el (ivy-completion-in-region-action): Obey :exit-function, Oleh Krehel, 2019/07/20
- [elpa] master 6075a73 243/399: swiper.el (swiper--add-overlays): Reuse swiper--add-overlay, Oleh Krehel, 2019/07/20
- [elpa] master 687aae2 246/399: swiper.el (swiper-query-replace): Check for empty input, Oleh Krehel, 2019/07/20
- [elpa] master 8df253a 249/399: swiper.el (swiper--isearch-same-line-p): Add, Oleh Krehel, 2019/07/20
- [elpa] master 773ac65 245/399: swiper.el (swiper--cleanup): Re-use lazy-highlight-cleanup, Oleh Krehel, 2019/07/20
- [elpa] master 815f094 252/399: swiper.el (swiper--add-line-overlay): Extract, Oleh Krehel, 2019/07/20
- [elpa] master eb1e636 253/399: swiper.el (swiper--add-cursor-overlay): Display only in current window, Oleh Krehel, 2019/07/20
- [elpa] master 7dc1445 256/399: swiper.el (swiper-isearch): Use the same faces in the minibuffer,
Oleh Krehel <=
- [elpa] master 4d40f88 255/399: swiper.el (swiper--isearch-function): Speedup for big files, Oleh Krehel, 2019/07/20
- [elpa] master 2ce81eb 240/399: swiper.el (swiper-isearch-toggle): Extend doc, Oleh Krehel, 2019/07/20
- [elpa] master cc92e1c 238/399: swiper.el (swiper--avy-goto): Handle quit, Oleh Krehel, 2019/07/20
- [elpa] master e6f49c2 244/399: swiper.el: Reorder by swiper--overlays, Oleh Krehel, 2019/07/20
- [elpa] master e04b10c 248/399: swiper.el (swiper-isearch-function): Refactor, Oleh Krehel, 2019/07/20
- [elpa] master ee71733 247/399: ivy.el (ivy-switch-buffer-other-window): Fix ivy-use-virtual-buffers, Oleh Krehel, 2019/07/20
- [elpa] master b05ae24 254/399: swiper.el (swiper--add-properties): Extract, Oleh Krehel, 2019/07/20
- [elpa] master db3e307 250/399: swiper.el (swiper--isearch-format): Extract, Oleh Krehel, 2019/07/20
- [elpa] master 58b6f7d 257/399: swiper.el (swiper--isearch-format): Don't use blending for the current match, Oleh Krehel, 2019/07/20
- [elpa] master f628441 259/399: swiper.el (swiper-isearch): Fix "C-r", Oleh Krehel, 2019/07/20