diff --git a/magit.el b/magit.el index c5070c66..886ac9ea 100644 --- a/magit.el +++ b/magit.el @@ -579,11 +579,16 @@ Many Magit faces inherit from this one by default." (magit-section-children section))) (magit-next-section section)))) + (if next (progn (goto-char (magit-section-beginning next)) (if (memq magit-submode '(log reflog)) - (magit-show-commit next))) + (magit-show-commit next)) + (let ((offset (- (line-number-at-pos (magit-section-beginning next)) + (line-number-at-pos (magit-section-end next))))) + (if (< offset (window-height)) + (recenter offset)))) (message "No next section")))) (defun magit-prev-section (section)