From 63e78891d8d3d3ed0c3d35b7d525ce7235d4ba14 Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Sun, 1 Mar 2009 03:02:19 +0200 Subject: [PATCH] Only try to fit current section into window when it is not hidden. * magit.el (magit-goto-next-section): Here. --- magit.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/magit.el b/magit.el index 6b25413f..be9edcb4 100644 --- a/magit.el +++ b/magit.el @@ -606,10 +606,13 @@ Many Magit faces inherit from this one by default." (goto-char (magit-section-beginning next)) (if (memq magit-submode '(log reflog)) (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)))) + (if (not (magit-section-hidden 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)