From 3efeed124ed9e9c47367084ba7c4c9aa9fbfda0b Mon Sep 17 00:00:00 2001 From: David Wallin Date: Thu, 19 Feb 2009 03:17:40 +0000 Subject: [PATCH] magit-goto-next-section: when moving down to the next section, try to fit the whole hunk in the window --- magit.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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)