emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master bb68b67 122/167: Intermediate fix for :preselect with visu


From: Oleh Krehel
Subject: [elpa] master bb68b67 122/167: Intermediate fix for :preselect with visual-line-mode
Date: Tue, 08 Dec 2015 10:50:27 +0000

branch: master
commit bb68b67b2bc6f95ddf667e4c34eb2902bcbf604b
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]