]> code.delx.au - gnu-emacs-elpa/commitdiff
Swiper should preserve column for empty input
authorOleh Krehel <ohwoeowho@gmail.com>
Mon, 1 Jun 2015 15:50:43 +0000 (17:50 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Mon, 1 Jun 2015 15:50:43 +0000 (17:50 +0200)
swiper.el (swiper--update-input-ivy): When there's no input yet, don't
move point.

Re #125

ivy.el
swiper.el

diff --git a/ivy.el b/ivy.el
index 07aa28c4124b5a372e4aabf7896831cd578667c3..40e83301fce5eec7382347c92d98d35abd8d823b 100644 (file)
--- a/ivy.el
+++ b/ivy.el
@@ -1277,7 +1277,6 @@ BUFFER may be a string or nil."
       (let ((pt (point))
             (le (line-end-position)))
         (forward-word 1)
-        (setf (window-point) (point))
         (if (> (point) le)
             (goto-char pt)
           (setq amend (buffer-substring-no-properties pt (point))))))
index 27e864ea763e226ef13434e2133692ded1fb4d1a..c27da2e07ee24e46777035b7d0f08d7b0e9dab89 100644 (file)
--- a/swiper.el
+++ b/swiper.el
@@ -287,7 +287,11 @@ Please remove it and update the \"swiper\" package."))
       (when (cl-plusp num)
         (goto-char (point-min))
         (forward-line (1- num))
-        (re-search-forward re (line-end-position) t)
+        (if (and (equal ivy-text "")
+                 (>= swiper--opoint (line-beginning-position))
+                 (<= swiper--opoint (line-end-position)))
+            (goto-char swiper--opoint)
+          (re-search-forward re (line-end-position) t))
         (isearch-range-invisible (line-beginning-position)
                                  (line-end-position))
         (unless (and (>= (point) (window-start))