[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 8482f62 179/399: swiper.el (swiper-isearch-function): Fix
From: |
Oleh Krehel |
Subject: |
[elpa] master 8482f62 179/399: swiper.el (swiper-isearch-function): Fix str is " " |
Date: |
Sat, 20 Jul 2019 14:57:19 -0400 (EDT) |
branch: master
commit 8482f621e568716d8f5d765427af58456588e80d
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
swiper.el (swiper-isearch-function): Fix str is " "
Fixes #2018
---
swiper.el | 61 +++++++++++++++++++++++++++++++------------------------------
1 file changed, 31 insertions(+), 30 deletions(-)
diff --git a/swiper.el b/swiper.el
index 302bae4..2df423a 100644
--- a/swiper.el
+++ b/swiper.el
@@ -1205,36 +1205,36 @@ come back to the same place as when \"a\" was initially
entered.")
(defun swiper-isearch-function (str)
"Collect STR matches in the current buffer for `swiper-isearch'."
- (unless (string= str "")
- (let* ((re-full (funcall ivy--regex-function str))
- (re (ivy-re-to-str re-full))
- (re (if (string-match "\\`\\(.*\\)[\\]|\\'" re)
- (match-string 1 re)
- re))
- (pt-hist (cdr (assoc str swiper--isearch-point-history)))
- cands
- idx-found
- (idx 0))
- (with-ivy-window
- (save-excursion
- (goto-char (point-min))
- (while (re-search-forward re nil t)
- (unless idx-found
- (when (or
- (eq (match-beginning 0) pt-hist)
- (>= (match-beginning 0) (cdar
swiper--isearch-point-history)))
- (push (cons str (match-beginning 0))
swiper--isearch-point-history)
- (setq idx-found idx)))
- (cl-incf idx)
- (let ((line (buffer-substring
- (line-beginning-position)
- (line-end-position))))
- (put-text-property 0 1 'point (point) line)
- (push line cands)))))
- (setq ivy--old-re re)
- (when idx-found
- (ivy-set-index idx-found))
- (setq ivy--old-cands (nreverse cands)))))
+ (let* ((re-full (funcall ivy--regex-function str))
+ (re (ivy-re-to-str re-full)))
+ (unless (string= re "")
+ (let ((re (if (string-match "\\`\\(.*\\)[\\]|\\'" re)
+ (match-string 1 re)
+ re))
+ (pt-hist (cdr (assoc str swiper--isearch-point-history)))
+ cands
+ idx-found
+ (idx 0))
+ (with-ivy-window
+ (save-excursion
+ (goto-char (point-min))
+ (while (re-search-forward re nil t)
+ (unless idx-found
+ (when (or
+ (eq (match-beginning 0) pt-hist)
+ (>= (match-beginning 0) (cdar
swiper--isearch-point-history)))
+ (push (cons str (match-beginning 0))
swiper--isearch-point-history)
+ (setq idx-found idx)))
+ (cl-incf idx)
+ (let ((line (buffer-substring
+ (line-beginning-position)
+ (line-end-position))))
+ (put-text-property 0 1 'point (point) line)
+ (push line cands)))))
+ (setq ivy--old-re re)
+ (when idx-found
+ (ivy-set-index idx-found))
+ (setq ivy--old-cands (nreverse cands))))))
(defun swiper--add-cursor-overlay ()
(let ((ov (make-overlay (point) (if (eolp) (point) (1+ (point))))))
@@ -1256,6 +1256,7 @@ come back to the same place as when \"a\" was initially
entered.")
(swiper--add-cursor-overlay)))
(swiper--cleanup)))
+;;;###autoload
(defun swiper-isearch (&optional initial-input)
"A `swiper' that's not line-based."
(interactive)
- [elpa] master 44ea8b5 166/399: counsel.el (counsel-git-grep-cmd-function): Add, (continued)
- [elpa] master 44ea8b5 166/399: counsel.el (counsel-git-grep-cmd-function): Add, Oleh Krehel, 2019/07/20
- [elpa] master 502eae6 159/399: counsel.el (counsel--call): Rename to counsel--command, Oleh Krehel, 2019/07/20
- [elpa] master 115efb7 170/399: ivy.el (ivy--sorted-files): Work around all-completions returning $$, Oleh Krehel, 2019/07/20
- [elpa] master 6c858c1 168/399: ivy.el (ivy--filter): Improve performance with :matcher, Oleh Krehel, 2019/07/20
- [elpa] master ba849e5 173/399: ivy.el (ivy--re-filter): Fix for ivy--regex-ignore-order, Oleh Krehel, 2019/07/20
- [elpa] master 5458f93 169/399: ivy.el (ivy--filter): Avoid a filter on empty input, Oleh Krehel, 2019/07/20
- [elpa] master 9c53320 174/399: swiper.el (swiper-isearch-function): Fix for strings with trailing \|, Oleh Krehel, 2019/07/20
- [elpa] master ce0a1f1 172/399: ivy.el (ivy--filter): Fix matcher not called on input "", Oleh Krehel, 2019/07/20
- [elpa] master 39759cf 180/399: ivy-test.el (ivy-with): Save current buffer, Oleh Krehel, 2019/07/20
- [elpa] master fa87b97 182/399: ivy-test.el: Print version, Oleh Krehel, 2019/07/20
- [elpa] master 8482f62 179/399: swiper.el (swiper-isearch-function): Fix str is " ",
Oleh Krehel <=
- [elpa] master 482088c 178/399: swiper.el (swiper--avy-candidates): Fix for swiper-background-faces, Oleh Krehel, 2019/07/20
- [elpa] master 0e62f0d 185/399: counsel.el (counsel-switch-buffer-other-window): Update prompt, Oleh Krehel, 2019/07/20
- [elpa] master 5115df3 184/399: counsel.el: counsel-switch-buffer-other-window: new command., Oleh Krehel, 2019/07/20
- [elpa] master 0a12708 164/399: swiper.el: Add swiper background faces, Oleh Krehel, 2019/07/20
- [elpa] master 7e73580 171/399: ivy-test.el (counsel-find-file-with-dollars): Add test, Oleh Krehel, 2019/07/20
- [elpa] master c47a7dc 176/399: ivy.el (ivy--filter): Don't cache if the result of matching cache is empty, Oleh Krehel, 2019/07/20
- [elpa] master 4171364 183/399: ivy-test.el (counsel-find-file-with-dotfiles): Disable for emacs27, Oleh Krehel, 2019/07/20
- [elpa] master d829338 190/399: counsel.el (counsel-recentf): Require match, Oleh Krehel, 2019/07/20
- [elpa] master 39f5c24 187/399: ivy-test.el: Use :expected-result, Oleh Krehel, 2019/07/20
- [elpa] master a9f9e41 189/399: Add counsel-descbinds-action-exec, Oleh Krehel, 2019/07/20