branch: master commit bb65c4e1ae5b4c0c9107e91401c2c679d763b351 Author: Oleh Krehel <ohwoeo...@gmail.com> Commit: Oleh Krehel <ohwoeo...@gmail.com>
swiper.el (swiper--current-window-start): Refactor Is now set to value and read only in one place. Set to nil in two other places. --- swiper.el | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/swiper.el b/swiper.el index 0ba5adc..c099f0c 100644 --- a/swiper.el +++ b/swiper.el @@ -668,7 +668,6 @@ When capture groups are present in the input, print them instead of lines." (unless (eq major-mode 'ivy-occur-grep-mode) (ivy-occur-grep-mode) (font-lock-mode -1)) - (setq swiper--current-window-start nil) (insert (format "-*- mode:grep; default-directory: %S -*-\n\n\n" default-directory)) (insert (format "%d candidates:\n" (length cands))) @@ -794,6 +793,7 @@ When non-nil, INITIAL-INPUT is the initial search pattern." (goto-char swiper--opoint)) (unless (or res (string= ivy-text "")) (cl-pushnew ivy-text swiper-history)) + (setq swiper--current-window-start nil) (when swiper--reveal-mode (reveal-mode 1))))) @@ -932,12 +932,7 @@ the face, window and priority of the overlay." (setq swiper--current-match-start (match-beginning 0)))) (isearch-range-invisible (line-beginning-position) (line-end-position)) - (when (and (swiper--recenter-p) - (or - (< (point) (window-start)) - (> (point) (window-end (ivy-state-window ivy-last) t)))) - (recenter)) - (setq swiper--current-window-start (window-start)))) + (swiper--maybe-recenter))) (swiper--add-overlays re (max