From a585fcd13da39d4efca9a2cb7637429d0c90f604 Mon Sep 17 00:00:00 2001 From: Oleh Krehel Date: Sun, 29 Nov 2015 17:01:35 +0100 Subject: [PATCH] Fix due to visual-line-mode weirdness * 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 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/swiper.el b/swiper.el index b67cc79ad..593f76335 100644 --- 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)) -- 2.39.2