mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
ui/vc-gutter: minor refactor
This commit is contained in:
@ -73,10 +73,10 @@ is deferred until the file is saved. Respects `git-gutter:disabled-modes'."
|
||||
(defun +vc-gutter-update-h (&rest _)
|
||||
"Refresh git-gutter on ESC. Return nil to prevent shadowing other
|
||||
`doom-escape-hook' hooks."
|
||||
(unless (or (memq this-command '(git-gutter:stage-hunk
|
||||
(ignore (or (memq this-command '(git-gutter:stage-hunk
|
||||
git-gutter:revert-hunk))
|
||||
inhibit-redisplay)
|
||||
(ignore (if git-gutter-mode
|
||||
inhibit-redisplay
|
||||
(if git-gutter-mode
|
||||
(git-gutter)
|
||||
(+vc-gutter-init-maybe-h))))))
|
||||
;; update git-gutter when using magit commands
|
||||
@ -87,9 +87,9 @@ is deferred until the file is saved. Respects `git-gutter:disabled-modes'."
|
||||
"Fixes `git-gutter:next-hunk' and `git-gutter:previous-hunk' sometimes
|
||||
jumping to random hunks."
|
||||
:override #'git-gutter:search-near-diff-index
|
||||
(cl-position-if (let ((lineno (line-number-at-pos)))
|
||||
(lambda (line)
|
||||
(funcall (if is-reverse #'> #'<) lineno line)))
|
||||
(cl-position-if (let ((lineno (line-number-at-pos))
|
||||
(fn (if is-reverse #'> #'<)))
|
||||
(lambda (line) (funcall fn lineno line)))
|
||||
diffinfos
|
||||
:key #'git-gutter-hunk-start-line
|
||||
:from-end is-reverse)))
|
||||
|
Reference in New Issue
Block a user