branch: master
commit bb68b67b2bc6f95ddf667e4c34eb2902bcbf604b
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
Intermediate fix for :preselect with visual-line-mode
* swiper.el (swiper--ivy): Use `beginning-of-visual-line' and
`end-of-visual-line'. This should fix the preselect problem for
non-duplicate buffer lines.
For duplicate buffer lines, a `visual-line-number-at-pos' function is
necessary. I don't currently know how to implement such a function in an
efficient way. The naive implementation could be pretty inefficient,
comparable to doubling `swiper' startup time with `visual-line-mode'.
Re #291
---
swiper.el | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/swiper.el b/swiper.el
index eec7434..b9722d4 100644
--- a/swiper.el
+++ b/swiper.el
@@ -343,8 +343,8 @@ When non-nil, INITIAL-INPUT is the initial search pattern."
(preselect
(if (bound-and-true-p visual-line-mode)
(concat " " (buffer-substring-no-properties
- (line-beginning-position)
- (line-end-position)))
+ (save-excursion (beginning-of-visual-line) (point))
+ (save-excursion (end-of-visual-line) (point))))
(1- (line-number-at-pos))))
(minibuffer-allow-text-properties t))
(unwind-protect