[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 4c3ecb4 157/348: Restore window position after using swipe
From: |
Oleh Krehel |
Subject: |
[elpa] master 4c3ecb4 157/348: Restore window position after using swiper. |
Date: |
Sat, 8 Apr 2017 11:03:47 -0400 (EDT) |
branch: master
commit 4c3ecb4d739df379dd01ac8c7dc17080e608dac3
Author: Stephen Whipple <address@hidden>
Commit: Stephen Whipple <address@hidden>
Restore window position after using swiper.
This prevents a "jumping" behavior which occurs when variables
such as `scroll-conservatively' are set to a high value.
* swiper.el (swiper--current-match-start): Hold the window-start
position for restoration.
(swiper--action): If `swiper-action-recenter' is nil, then restore
the window-start that was used during selection.
---
swiper.el | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/swiper.el b/swiper.el
index 65f3690..d941f73 100644
--- a/swiper.el
+++ b/swiper.el
@@ -409,11 +409,13 @@ When REVERT is non-nil, regenerate the current
*ivy-occur* buffer."
(defvar swiper--current-line nil)
(defvar swiper--current-match-start nil)
+(defvar swiper--current-window-start nil)
(defun swiper--init ()
"Perform initialization common to both completion methods."
(setq swiper--current-line nil)
(setq swiper--current-match-start nil)
+ (setq swiper--current-window-start nil)
(setq swiper--opoint (point))
(when (bound-and-true-p evil-mode)
(evil-set-jump)))
@@ -574,7 +576,8 @@ Matched candidates should have `swiper-invocation-face'."
(line-end-position))
(unless (and (>= (point) (window-start))
(<= (point) (window-end (ivy-state-window ivy-last)
t)))
- (recenter))))
+ (recenter))
+ (setq swiper--current-window-start (window-start))))
(swiper--add-overlays re)))))
(defun swiper--add-overlays (re &optional beg end wnd)
@@ -651,8 +654,9 @@ WND, when specified is the window."
ln)
(re-search-forward re (line-end-position) t)
(swiper--ensure-visible)
- (when swiper-action-recenter
- (recenter))
+ (if swiper-action-recenter
+ (recenter)
+ (set-window-start (selected-window) swiper--current-window-start))
(when (/= (point) swiper--opoint)
(unless (and transient-mark-mode mark-active)
(when (eq ivy-exit 'done)
- [elpa] master 61c2b12 125/348: counsel-git-grep now supports custom per-project commands, (continued)
- [elpa] master 61c2b12 125/348: counsel-git-grep now supports custom per-project commands, Oleh Krehel, 2017/04/08
- [elpa] master 434ccce 150/348: swiper.el (swiper-font-lock-exclude): Add bookmark-bmenu-mode, Oleh Krehel, 2017/04/08
- [elpa] master 242ae95 148/348: ivy.el (ivy--reset-state): Fix read-only collection member, Oleh Krehel, 2017/04/08
- [elpa] master a99c125 161/348: counsel.el (counsel-grep): Specify :re-builder, Oleh Krehel, 2017/04/08
- [elpa] master 4e6145c 168/348: counsel.el (counsel-yank-pop-separator): New defcustom, Oleh Krehel, 2017/04/08
- [elpa] master b73264e 163/348: counsel.el (counsel-git-log-cmd): New defvar, Oleh Krehel, 2017/04/08
- [elpa] master 7457d1e 169/348: Add leading zeros to the hex representation to counsel-unicode-char, Oleh Krehel, 2017/04/08
- [elpa] master 8983f9d 167/348: counsel.el (counsel-recentf): Turn on recentf, Oleh Krehel, 2017/04/08
- [elpa] master 6961df6 166/348: doc/ivy.org: Replace swiper with counsel (MELPA), Oleh Krehel, 2017/04/08
- [elpa] master 3656dfe 171/348: ivy.el (ivy-exit-with-action): Remove with-ivy-window, Oleh Krehel, 2017/04/08
- [elpa] master 4c3ecb4 157/348: Restore window position after using swiper.,
Oleh Krehel <=
- [elpa] master 94f3368 160/348: Extract ivy--flx-propertize from ivy--flx-sort, Oleh Krehel, 2017/04/08
- [elpa] master 6b574e4 173/348: ivy.el (ivy-call): expand-file-name, Oleh Krehel, 2017/04/08
- [elpa] master 93f9321 174/348: ivy.el: Fix byte compiler warnings, Oleh Krehel, 2017/04/08
- [elpa] master 2a9c3f3 191/348: swiper.el (swiper-multi): Don't use virtual buffers, Oleh Krehel, 2017/04/08
- [elpa] master 3a7c8cd 189/348: counsel.el (counsel-recentf): add extra actions, Oleh Krehel, 2017/04/08
- [elpa] master 955585e 190/348: counsel.el (counsel-describe-face): Ensure :preselect string, Oleh Krehel, 2017/04/08
- [elpa] master 3c904fa 192/348: counsel.el (counsel-git-grep-occur): Fix "g", Oleh Krehel, 2017/04/08
- [elpa] master 77ebfdb 196/348: Makefile: load ivy-overlay.el, Oleh Krehel, 2017/04/08
- [elpa] master f357cd2 198/348: ivy-overlay.el (ivy-overlay-cleanup): Restore cursor-type, Oleh Krehel, 2017/04/08
- [elpa] master f8d78eb 197/348: Add a fake cursor to inline completion display, Oleh Krehel, 2017/04/08