[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 52295c4 137/184: swiper.el (swiper-isearch): Fix searching
From: |
Oleh Krehel |
Subject: |
[elpa] master 52295c4 137/184: swiper.el (swiper-isearch): Fix searching for "$^" |
Date: |
Wed, 16 Oct 2019 13:15:09 -0400 (EDT) |
branch: master
commit 52295c4b915d915c8ecc6a13d2a091def4a0afae
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
swiper.el (swiper-isearch): Fix searching for "$^"
Re #2232
---
swiper.el | 54 +++++++++++++++++++++++++++++++++---------------------
1 file changed, 33 insertions(+), 21 deletions(-)
diff --git a/swiper.el b/swiper.el
index 08afea2..c3c11c8 100644
--- a/swiper.el
+++ b/swiper.el
@@ -730,10 +730,14 @@ line numbers. For the buffer, use `ivy--regex' instead."
(cl-remove-if-not #'cdr re)
".*?")
re)))
- (if (zerop ivy--subexps)
- (prog1 (format "^ ?\\(%s\\)" re)
- (setq ivy--subexps 1))
- (format "^ %s" re))))
+ (cond
+ ((string= re "$")
+ "^$")
+ ((zerop ivy--subexps)
+ (prog1 (format "^ ?\\(%s\\)" re)
+ (setq ivy--subexps 1)))
+ (t
+ (format "^ %s" re)))))
((eq (bound-and-true-p search-default-mode)
'char-fold-to-regexp)
(if (string-match "\\`\\\\_<\\(.+\\)\\\\_>\\'" str)
(concat
@@ -1323,18 +1327,24 @@ See `ivy-format-functions-alist' for further
information."
(defvar swiper--isearch-start-point nil)
(defun swiper--isearch-function-1 (re backward)
- (let (cands)
- (save-excursion
- (goto-char (if backward (point-max) (point-min)))
- (while (funcall (if backward #'re-search-backward #'re-search-forward)
re nil t)
- (when (swiper-match-usable-p)
- (let ((pos (if (or backward swiper-goto-start-of-match)
- (match-beginning 0)
- (point))))
- (push pos cands)))))
- (if backward
- cands
- (nreverse cands))))
+ (unless (string= re ".")
+ (let (cands)
+ (save-excursion
+ (goto-char (if backward (point-max) (point-min)))
+ (while (and (funcall (if backward #'re-search-backward
#'re-search-forward) re nil t)
+ (not (if backward (bobp) (eobp))))
+ (when (swiper-match-usable-p)
+ (let ((pos (if (or backward swiper-goto-start-of-match)
+ (match-beginning 0)
+ (point))))
+ (push pos cands)))
+ (when (= (match-beginning 0) (match-end 0))
+ (if backward
+ (backward-char)
+ (forward-char)))))
+ (if backward
+ cands
+ (nreverse cands)))))
(defun swiper--isearch-next-item (re cands)
(if swiper--isearch-backward
@@ -1489,11 +1499,13 @@ When not running `swiper-isearch' already, start it."
(defun swiper-isearch-format-function (cands)
(if (numberp (car-safe cands))
- (swiper--isearch-format
- ivy--index ivy--length ivy--old-cands
- ivy--old-re
- (ivy-state-current ivy-last)
- (ivy-state-buffer ivy-last))
+ (if (string= ivy--old-re "^$")
+ ""
+ (swiper--isearch-format
+ ivy--index ivy--length ivy--old-cands
+ ivy--old-re
+ (ivy-state-current ivy-last)
+ (ivy-state-buffer ivy-last)))
(ivy-format-function-default cands)))
(defun swiper--line-at-point (pt)
- [elpa] master 57e0b94 146/184: swiper.el (swiper--action): Set case-fold-search, (continued)
- [elpa] master 57e0b94 146/184: swiper.el (swiper--action): Set case-fold-search, Oleh Krehel, 2019/10/16
- [elpa] master cdca2fc 141/184: counsel.el (counsel-switch-buffer): Re-use ivy-switch-buffer, Oleh Krehel, 2019/10/16
- [elpa] master a5701a9 159/184: ivy.el (ivy-configure): Add :format-fn, Oleh Krehel, 2019/10/16
- [elpa] master 4d533b2 178/184: counsel.el (counsel-dired): Filter to directories only, Oleh Krehel, 2019/10/16
- [elpa] master ec1ed07 171/184: counsel.el (counsel--find-file-1): Use dired-current-directory for dired, Oleh Krehel, 2019/10/16
- [elpa] master 1d8803e 181/184: Ensure that ripgrep on windows uses '/' as the path-separator, Oleh Krehel, 2019/10/16
- [elpa] master 7854d03 129/184: counsel.el (counsel-google): Add, Oleh Krehel, 2019/10/16
- [elpa] master cd634c6 183/184: doc/Changelog.org: Release 0.13.0, Oleh Krehel, 2019/10/16
- [elpa] master 0dfd70d 135/184: counsel.el (counsel-google-function): Require json, Oleh Krehel, 2019/10/16
- [elpa] master eed1f06 138/184: counsel.el (counsel--py-action): Don't auto-insert parens, Oleh Krehel, 2019/10/16
- [elpa] master 52295c4 137/184: swiper.el (swiper-isearch): Fix searching for "$^",
Oleh Krehel <=
- [elpa] master 80c2669 142/184: ivy.el (ivy--alist-set): Work-around emacs-24.3 not having alist-get, Oleh Krehel, 2019/10/16
- [elpa] master 8b07572 149/184: ivy.el (ivy-configure): Add :display-transformer-fn, Oleh Krehel, 2019/10/16
- [elpa] master 9da8003 158/184: counsel.el (counsel-M-x): Don't sort by default, Oleh Krehel, 2019/10/16
- [elpa] master 8f08f38 155/184: counsel.el (counsel--grep-last-pos): Refactor from counsel-grep-last-line, Oleh Krehel, 2019/10/16
- [elpa] master 6b40d40 156/184: ivy.el (ivy--occur-press-update-window): Re-use ivy-highlight-grep-commands, Oleh Krehel, 2019/10/16
- [elpa] master 2ed4416 165/184: ivy.el (ivy-configure): Add :exit-codes, Oleh Krehel, 2019/10/16
- [elpa] master 2ce5450 177/184: counsel.el (counsel-find-file): Bind "M-o R" to find-file-read-only, Oleh Krehel, 2019/10/16
- [elpa] master c82b852 174/184: ivy.el (ivy-occur-revert-buffer): Simplify, Oleh Krehel, 2019/10/16
- [elpa] master 8bc23e6 104/184: counsel.el (counsel-compile): delete duplicates, Oleh Krehel, 2019/10/16
- [elpa] master 966525c 118/184: counsel.el (counsel-cd): Fix for counsel-ag, Oleh Krehel, 2019/10/16