[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/swiper 8bf8027e4b 1/2: Fix swiper preselect when initia
From: |
Basil L. Contovounesios |
Subject: |
[elpa] externals/swiper 8bf8027e4b 1/2: Fix swiper preselect when initial-input specified |
Date: |
Sat, 30 Apr 2022 18:52:07 -0400 (EDT) |
branch: externals/swiper
commit 8bf8027e4bd8c093bddb76a813952d2a0dcbf21d
Author: Severin Kempf <skempf@indyeng.com>
Commit: Basil L. Contovounesios <contovob@tcd.ie>
Fix swiper preselect when initial-input specified
When swiper is called with an initial-input and the current point is
on a line that does not contain a match, the previous code would
return nil for preselect, which would position the first viable
candidate as the first candidate in the buffer.
This small change selects the first candidate at or following the
current point, which allows for a simple repeat-search function to
wrap a call to swiper.
* swiper.el (swiper): Fix preselect search condition (PR #2930).
Copyright-paperwork-exempt: yes
---
swiper.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/swiper.el b/swiper.el
index f3bebab854..ba9ed6b9c6 100644
--- a/swiper.el
+++ b/swiper.el
@@ -816,7 +816,7 @@ When non-nil, INITIAL-INPUT is the initial search pattern."
(if initial-input
(cl-position-if
(lambda (x)
- (= (1+ preselect) (swiper--line-number x)))
+ (<= (1+ preselect) (swiper--line-number x)))
(progn
(setq ivy--old-re nil)
(ivy--filter initial-input candidates)))