]> code.delx.au - gnu-emacs-elpa/commitdiff
Fix due to visual-line-mode weirdness
authorOleh Krehel <ohwoeowho@gmail.com>
Sun, 29 Nov 2015 16:01:35 +0000 (17:01 +0100)
committerOleh Krehel <ohwoeowho@gmail.com>
Sun, 29 Nov 2015 16:01:35 +0000 (17:01 +0100)
* swiper.el (swiper--candidates): Under a specific random condition,
(line-move 1) from the beginning of line doesn't move to the beginning
of the next visual line.

This change fixes it, but will result in an even slower startup when
`visual-line-mode' is active.

Fixes #313

swiper.el

index b67cc79adfd5e8c6c04dc6ccac78a32345fad588..593f7633549171a798f6fd11d9ea1cc79ba4f79c 100644 (file)
--- a/swiper.el
+++ b/swiper.el
@@ -280,12 +280,16 @@ count."
                         " "
                         (replace-regexp-in-string
                          "\t" "    "
-                         (buffer-substring
-                          (point)
-                          (if swiper-use-visual-line
+                         (if swiper-use-visual-line
+                             (buffer-substring
                               (save-excursion
-                                (end-of-visual-line)
+                                (beginning-of-visual-line)
                                 (point))
+                              (save-excursion
+                                (end-of-visual-line)
+                                (point)))
+                           (buffer-substring
+                            (point)
                             (line-end-position)))))))
               (when (eq major-mode 'twittering-mode)
                 (remove-text-properties 0 (length str) '(field) str))