[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master be716a1 08/12: swiper.el (swiper--add-overlays): Update ar
From: |
Oleh Krehel |
Subject: |
[elpa] master be716a1 08/12: swiper.el (swiper--add-overlays): Update arglist |
Date: |
Tue, 21 Apr 2015 12:09:22 +0000 |
branch: master
commit be716a1f2408fa0e58cf08c9e2612b098e6f0ab1
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
swiper.el (swiper--add-overlays): Update arglist
* swiper.el (swiper--update-input-ivy): Update.
(swiper--add-overlays): Take only the regexp as the argument.
Figure out the bounds by itself.
---
swiper.el | 83 ++++++++++++++++++++++++++++++-------------------------------
1 files changed, 41 insertions(+), 42 deletions(-)
diff --git a/swiper.el b/swiper.el
index 1afd056..b46702b 100644
--- a/swiper.el
+++ b/swiper.el
@@ -234,48 +234,47 @@ When non-nil, INITIAL-INPUT is the initial search
pattern."
(unless (and (>= (point) (window-start))
(<= (point) (window-end swiper--window t)))
(recenter)))
- (let ((ov (make-overlay
- (line-beginning-position)
- (1+ (line-end-position)))))
- (overlay-put ov 'face 'swiper-line-face)
- (overlay-put ov 'window swiper--window)
- (push ov swiper--overlays))
- (let ((wh (window-height)))
- (swiper--add-overlays
- re
- (save-excursion
- (forward-line (- wh))
- (point))
- (save-excursion
- (forward-line wh)
- (point)))))))
-
-(defun swiper--add-overlays (re beg end)
- "Add overlays for RE regexp in current buffer between BEG and END."
- (when (>= (length re) swiper-min-highlight)
- (save-excursion
- (goto-char beg)
- ;; RE can become an invalid regexp
- (while (and (ignore-errors (re-search-forward re end t))
- (> (- (match-end 0) (match-beginning 0)) 0))
- (let ((i 0))
- (while (<= i ivy--subexps)
- (when (match-beginning i)
- (let ((overlay (make-overlay (match-beginning i)
- (match-end i)))
- (face
- (cond ((zerop ivy--subexps)
- (cl-caddr swiper-faces))
- ((zerop i)
- (car swiper-faces))
- (t
- (nth (1+ (mod (1- i) (1- (length swiper-faces))))
- swiper-faces)))))
- (push overlay swiper--overlays)
- (overlay-put overlay 'face face)
- (overlay-put overlay 'window swiper--window)
- (overlay-put overlay 'priority i)))
- (cl-incf i)))))))
+ (swiper--add-overlays re))))
+
+(defun swiper--add-overlays (re)
+ "Add overlays for RE regexp in visible part of the current buffer."
+ (let ((ov (make-overlay
+ (line-beginning-position)
+ (1+ (line-end-position)))))
+ (overlay-put ov 'face 'swiper-line-face)
+ (overlay-put ov 'window swiper--window)
+ (push ov swiper--overlays))
+ (let* ((wh (window-height))
+ (beg (save-excursion
+ (forward-line (- wh))
+ (point)))
+ (end (save-excursion
+ (forward-line wh)
+ (point))))
+ (when (>= (length re) swiper-min-highlight)
+ (save-excursion
+ (goto-char beg)
+ ;; RE can become an invalid regexp
+ (while (and (ignore-errors (re-search-forward re end t))
+ (> (- (match-end 0) (match-beginning 0)) 0))
+ (let ((i 0))
+ (while (<= i ivy--subexps)
+ (when (match-beginning i)
+ (let ((overlay (make-overlay (match-beginning i)
+ (match-end i)))
+ (face
+ (cond ((zerop ivy--subexps)
+ (cl-caddr swiper-faces))
+ ((zerop i)
+ (car swiper-faces))
+ (t
+ (nth (1+ (mod (1- i) (1- (length swiper-faces))))
+ swiper-faces)))))
+ (push overlay swiper--overlays)
+ (overlay-put overlay 'face face)
+ (overlay-put overlay 'window swiper--window)
+ (overlay-put overlay 'priority i)))
+ (cl-incf i))))))))
(defun swiper--action (x input)
"Goto line X and search for INPUT."
- [elpa] master updated (3d54459 -> e86b27e), Oleh Krehel, 2015/04/21
- [elpa] master 0d1fa17 01/12: ivy.el (ivy-done): Expand file name for empty text, Oleh Krehel, 2015/04/21
- [elpa] master 36b15f3 02/12: ivy.el (ivy--regex): Switch to non-greedy ".*?" joiner, Oleh Krehel, 2015/04/21
- [elpa] master 49638b4 04/12: ivy.el (ivy--sorted-files): Avoid returning an empty list, Oleh Krehel, 2015/04/21
- [elpa] master 2a5d3fc 05/12: Fix double-sorting for file names, Oleh Krehel, 2015/04/21
- [elpa] master bb89c9d 03/12: Allow to customize the sorting methods, Oleh Krehel, 2015/04/21
- [elpa] master 94c124d 07/12: ivy.el (ivy-done): Don't directory-expand glob filename, Oleh Krehel, 2015/04/21
- [elpa] master 5268d10 06/12: Add an option to call the completion action without exiting, Oleh Krehel, 2015/04/21
- [elpa] master 9d5b60f 09/12: ivy.el (ivy--regex): Add optional greedy arg, Oleh Krehel, 2015/04/21
- [elpa] master be716a1 08/12: swiper.el (swiper--add-overlays): Update arglist,
Oleh Krehel <=
- [elpa] master b724678 10/12: counsel.el: Add awesome swiper highlighting to git grep, Oleh Krehel, 2015/04/21
- [elpa] master 675bd5f 11/12: Fix describe-function / -variable "C-." interaction, Oleh Krehel, 2015/04/21
- [elpa] master e86b27e 12/12: Merge commit '675bd5ff97f75fb7d838e6056442ce71adf85e56' from swiper, Oleh Krehel, 2015/04/21