mirror of
https://github.com/doomemacs/doomemacs.git
synced 2025-12-06 02:30:33 -08:00
tweak(magit): only preserve point if region-active-p
Only preserve cursor/window position on stage/unstaging/discarding/etc hunks when region is active. Otherwise, it's fine not to.
This commit is contained in:
parent
95a375182b
commit
e87a92be75
1 changed files with 3 additions and 2 deletions
|
|
@ -97,8 +97,9 @@ FUNCTION
|
|||
(defvar +magit--refreshed-buffer nil)
|
||||
(add-hook! 'magit-pre-refresh-hook
|
||||
(defun +magit--set-window-state-h ()
|
||||
(setq-local +magit--refreshed-buffer
|
||||
(list (current-buffer) (point) (window-start)))))
|
||||
(when (doom-region-active-p)
|
||||
(setq-local +magit--refreshed-buffer
|
||||
(list (current-buffer) (doom-region-beginning) (window-start))))))
|
||||
(add-hook! 'magit-post-refresh-hook
|
||||
(defun +magit--restore-window-state-h ()
|
||||
(cl-destructuring-bind (&optional buf pt beg) +magit--refreshed-buffer
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue