branch: elpa/magit
commit a0a610af0cb398b8e17d65b1bb8bbb39f51b8efe
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>

    magit-diff-visit--position: Refactor for clarity
    
    Similar to how this was done for `magit-find-file--restore-position'
    in the previous commit.
---
 lisp/magit-diff.el | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el
index a4cf9871ea..13a1ee505d 100644
--- a/lisp/magit-diff.el
+++ b/lisp/magit-diff.el
@@ -1815,13 +1815,15 @@ the Magit-Status buffer for DIRECTORY."
              (line   (magit-diff-hunk-line   hunk goto-from))
              (column (magit-diff-hunk-column hunk goto-from)))
     (with-current-buffer buffer
-      (when (and goto-file (not (equal rev "{worktree}")))
-        (setq line (apply #'magit-diff-visit--offset line file
-                          (and (not (equal rev "{index}")) (list rev)))))
       (save-restriction
         (widen)
         (goto-char (point-min))
-        (forward-line (1- line))
+        (forward-line
+         (1- (pcase rev
+               ((guard (not goto-file)) line)
+               ("{worktree}" line)
+               ("{index}" (magit-diff-visit--offset line file))
+               (_ (magit-diff-visit--offset line file rev)))))
         (move-to-column column)
         (point)))))
 

Reply via email to