[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master db3e307 250/399: swiper.el (swiper--isearch-format): Extra
From: |
Oleh Krehel |
Subject: |
[elpa] master db3e307 250/399: swiper.el (swiper--isearch-format): Extract |
Date: |
Sat, 20 Jul 2019 14:57:34 -0400 (EDT) |
branch: master
commit db3e3078af91547edcea73f67a1d0d17aaee3add
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
swiper.el (swiper--isearch-format): Extract
A more pure function, suitable for testing.
---
swiper.el | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/swiper.el b/swiper.el
index 14f8801..8850090 100644
--- a/swiper.el
+++ b/swiper.el
@@ -1330,22 +1330,28 @@ When not running `swiper-isearch' already, start it."
1)))
(defun swiper-isearch-format-function (_cands)
+ (swiper--isearch-format
+ ivy--index ivy--length ivy--old-cands
+ ivy--old-re
+ (ivy-state-current ivy-last)
+ (ivy-state-buffer ivy-last)))
+
+(defun swiper--isearch-format (index length cands regex current buffer)
(let* ((half-height (/ ivy-height 2))
- (current (ivy-state-current ivy-last))
- (i (1- ivy--index))
+ (i (1- index))
(j 0)
(len 0)
res s)
- (with-ivy-window
+ (with-current-buffer buffer
(while (and (>= i 0)
(swiper--isearch-same-line-p
- (nth i ivy--old-cands)
+ (nth i cands)
current))
(cl-decf i)
(cl-incf j))
(while (and (>= i 0)
(< len half-height))
- (setq s (nth i ivy--old-cands))
+ (setq s (nth i cands))
(unless (swiper--isearch-same-line-p s (car res))
(push (ivy--format-minibuffer-line s) res)
(cl-incf len))
@@ -1357,22 +1363,22 @@ When not running `swiper-isearch' already, start it."
'ivy-current-match))
(start 0))
(dotimes (_ (1+ j))
- (string-match ivy--old-re current-str start)
+ (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)
(push current-str res))
(cl-incf len)
- (setq i (1+ ivy--index))
- (while (and (< i ivy--length)
+ (setq i (1+ index))
+ (while (and (< i length)
(swiper--isearch-same-line-p
- (nth i ivy--old-cands)
+ (nth i cands)
current))
(cl-incf i))
- (while (and (< i ivy--length)
+ (while (and (< i length)
(< len ivy-height))
- (setq s (nth i ivy--old-cands))
+ (setq s (nth i cands))
(unless (swiper--isearch-same-line-p s (car res))
(push (ivy--format-minibuffer-line s) res)
(cl-incf len))
- [elpa] master 815f094 252/399: swiper.el (swiper--add-line-overlay): Extract, (continued)
- [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, 2019/07/20
- [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 <=
- [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
- [elpa] master 743163c 260/399: counsel.el (counsel-minor-history): New history variable, Oleh Krehel, 2019/07/20
- [elpa] master cbb3ee1 262/399: counsel.el (counsel-company): Don't rely on company-point, Oleh Krehel, 2019/07/20
- [elpa] master 77a5ffc 261/399: counsel.el (counsel-package-history): New history variable, Oleh Krehel, 2019/07/20
- [elpa] master d5c9673 265/399: swiper.el (swiper--isearch-format): Fix permanent face modifications, Oleh Krehel, 2019/07/20
- [elpa] master 2c57036 263/399: ivy.el (ivy-call): Modify the API for ivy-action second arg, Oleh Krehel, 2019/07/20
- [elpa] master bea44b7 264/399: counsel.el: Fix compiler warnings, Oleh Krehel, 2019/07/20
- [elpa] master a2af29b 271/399: ivy.el (ivy--occur-insert-lines): Fix missing line numbers, Oleh Krehel, 2019/07/20
- [elpa] master 9a9e3e4 251/399: ivy-test.el (swiper--isearch-format): Add test, Oleh Krehel, 2019/07/20