[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/git-commit 4ff3db8a5e 1/2: magit-diff-hunk-line: Visit for
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/git-commit 4ff3db8a5e 1/2: magit-diff-hunk-line: Visit for diffs that lack a proper hunk |
Date: |
Sat, 26 Mar 2022 05:58:15 -0400 (EDT) |
branch: elpa/git-commit
commit 4ff3db8a5e705b30bad6d964a878e423c5077016
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
magit-diff-hunk-line: Visit for diffs that lack a proper hunk
Such as renames.
---
lisp/magit-diff.el | 31 ++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)
diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el
index 71532cafd8..ed90c76a51 100644
--- a/lisp/magit-diff.el
+++ b/lisp/magit-diff.el
@@ -1694,21 +1694,22 @@ the Magit-Status buffer for DIRECTORY."
(save-excursion
(goto-char (line-beginning-position))
(with-slots (content combined from-ranges from-range to-range) section
- (when (and magit-diff-visit-jump-to-change (< (point) content))
- (goto-char content)
- (re-search-forward "^[-+]"))
- (+ (car (if goto-from from-range to-range))
- (let ((prefix (if combined (length from-ranges) 1))
- (target (point))
- (offset 0))
- (goto-char content)
- (while (< (point) target)
- (unless (string-match-p
- (if goto-from "\\+" "-")
- (buffer-substring (point) (+ (point) prefix)))
- (cl-incf offset))
- (forward-line))
- offset)))))
+ (when (or from-range to-range)
+ (when (and magit-diff-visit-jump-to-change (< (point) content))
+ (goto-char content)
+ (re-search-forward "^[-+]"))
+ (+ (car (if goto-from from-range to-range))
+ (let ((prefix (if combined (length from-ranges) 1))
+ (target (point))
+ (offset 0))
+ (goto-char content)
+ (while (< (point) target)
+ (unless (string-match-p
+ (if goto-from "\\+" "-")
+ (buffer-substring (point) (+ (point) prefix)))
+ (cl-incf offset))
+ (forward-line))
+ offset))))))
(defun magit-diff-hunk-column (section goto-from)
(if (or (< (magit-point)