branch: master
commit fe057eb2ed7cc87a1eb9ee6ae52750dc7d5beab4
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
Swiper should preserve column for empty input
swiper.el (swiper--update-input-ivy): When there's no input yet, don't
move point.
Re #125
---
ivy.el | 1 -
swiper.el | 6 +++++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/ivy.el b/ivy.el
index 07aa28c..40e8330 100644
--- 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))))))
diff --git a/swiper.el b/swiper.el
index 27e864e..c27da2e 100644
--- 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))