branch: elpa/git-commit
commit 1bac69d91defb86e2e992a13a1c5b4e14a7e24a2
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>

    magit-blame--line-beginning-position: New function
---
 lisp/magit-blame.el | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/lisp/magit-blame.el b/lisp/magit-blame.el
index 48097258a1..93d37e854d 100644
--- a/lisp/magit-blame.el
+++ b/lisp/magit-blame.el
@@ -543,18 +543,22 @@ modes is toggled, then this mode also gets toggled 
automatically.
     (save-excursion
       (save-restriction
         (widen)
-        (goto-char (point-min))
-        (forward-line (1- (oref chunk final-line)))
-        (let ((beg (point))
-              (end (save-excursion
-                     (forward-line (oref chunk num-lines))
-                     (point))))
+        (let* ((line (oref chunk final-line))
+               (beg (magit-blame--line-beginning-position line))
+               (end (magit-blame--line-beginning-position
+                     (+ line (oref chunk num-lines)))))
           (magit-blame--remove-overlays beg end)
           (when magit-blame--make-margin-overlays
             (magit-blame--make-margin-overlays chunk revinfo beg end))
           (magit-blame--make-heading-overlay chunk revinfo beg end)
           (magit-blame--make-highlight-overlay chunk beg))))))
 
+(defun magit-blame--line-beginning-position (line)
+  (save-excursion
+    (goto-char (point-min))
+    (forward-line (1- line))
+    (point)))
+
 (defun magit-blame--make-margin-overlays (chunk revinfo _beg end)
   (save-excursion
     (let ((line 0))

Reply via email to