aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2015-08-12 19:47:35 +0200
committerJonas Bernoulli <jonas@bernoul.li>2015-08-12 19:47:35 +0200
commitb67e18c69ea6eeb4f98182cfbe542b3dca633e9d (patch)
treefd4c59dbce8eed140b5f515e4e1aeddcbbeb8479 /lisp
parent78984d6de2ee6e06c801e4441a119b6f5ed44774 (diff)
magit-section-goto-successor: avoid falling back to back button
Depending on option `magit-revision-show-xref-buttons' diff buffers may end with a "back" buttons. When refreshing a buffer we try to select the reincarnation of the previously current section and if that fails fallback to the reincarnation of some "related" section, like the next sibling or parent. The final fallback is whatever section came after the selected section before the refresh and has a reincarnation after the refresh. In diff buffers that very often is the "back" button, but focusing on that section is useless. Instead we explicitly detect this case and instead of going to that button go to the beginning of the buffer. Re #2164.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/magit-section.el4
1 files changed, 3 insertions, 1 deletions
diff --git a/lisp/magit-section.el b/lisp/magit-section.el
index 3ee37a4..1807179 100644
--- a/lisp/magit-section.el
+++ b/lisp/magit-section.el
@@ -920,7 +920,9 @@ invisible."
(unless (eq (magit-current-section) it)
(goto-char start))))
(goto-char (--if-let (magit-section-goto-successor-1 section)
- (magit-section-start it)
+ (if (eq (magit-section-type it) 'button)
+ (point-min)
+ (magit-section-start it))
(point-min))))))
(defun magit-section-goto-successor-1 (section)