LOG:
Improve magit-find-section-before to find the closest section
before point. This fixes the surprising jump when invoking
magit-goto-previous-section from an empty line.
magit.el | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/magit.el b/magit.el
index 40940fd..98d807f 100644
--- a/magit.el
+++ b/magit.el
@@ -712,12 +712,14 @@ If TYPE is nil, the section won't be highlighted."
(defun magit-find-section-before (pos secs)
"Find the last section in the list SECS that begin before POS."
- (let ((prev nil))
+ (let ((prev nil) children)
(while (and secs
(not (> (magit-section-beginning (car secs)) pos)))
(setq prev (car secs))
(setq secs (cdr secs)))
- prev))
+ (if (and prev (setq children (magit-section-children prev)))
+ (magit-find-section-before pos children)
+ prev)))
(defun magit-current-section ()
"Return the magit section at point."
--
1.6.5.8
--
To unsubscribe, reply using "remove me" as the subject.