emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/magit e254dda362 07/28: magit-diff-highlight-list: Fix cas


From: Jonas Bernoulli
Subject: [nongnu] elpa/magit e254dda362 07/28: magit-diff-highlight-list: Fix case when showing an error
Date: Fri, 6 Dec 2024 17:17:03 -0500 (EST)

branch: elpa/magit
commit e254dda362865945b19facc2a452e9c802b3213b
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    magit-diff-highlight-list: Fix case when showing an error
    
    Usually each child has to be highlighted individually.  When we are
    displaying an error instead, then there are no children and we have
    to fall back to regular highlighting.
---
 lisp/magit-diff.el | 38 ++++++++++++++++++++------------------
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el
index 224a28d25a..e8214eef84 100644
--- a/lisp/magit-diff.el
+++ b/lisp/magit-diff.el
@@ -3197,24 +3197,26 @@ are highlighted."
     (_     (magit-section-highlight section nil))))
 
 (defun magit-diff-highlight-list (section &optional selection)
-  (let ((beg (oref section start))
-        (cnt (oref section content))
-        (end (oref section end)))
-    (when (or (eq this-command #'mouse-drag-region)
-              (not selection))
-      (unless (and (region-active-p)
-                   (<= (region-beginning) beg))
-        (magit-section-make-overlay beg cnt 'magit-section-highlight))
-      (if (oref section hidden)
-          (oset section washer #'ignore)
-        (dolist (child (oref section children))
-          (when (or (eq this-command #'mouse-drag-region)
-                    (not (and (region-active-p)
-                              (<= (region-beginning)
-                                  (oref child start)))))
-            (magit-diff-highlight-recursive child selection)))))
-    (when magit-diff-highlight-hunk-body
-      (magit-section-make-overlay (1- end) end 'magit-section-highlight))))
+  (if (oref section children)
+      (let ((beg (oref section start))
+            (cnt (oref section content))
+            (end (oref section end)))
+        (when (or (eq this-command #'mouse-drag-region)
+                  (not selection))
+          (unless (and (region-active-p)
+                       (<= (region-beginning) beg))
+            (magit-section-make-overlay beg cnt 'magit-section-highlight))
+          (if (oref section hidden)
+              (oset section washer #'ignore)
+            (dolist (child (oref section children))
+              (when (or (eq this-command #'mouse-drag-region)
+                        (not (and (region-active-p)
+                                  (<= (region-beginning)
+                                      (oref child start)))))
+                (magit-diff-highlight-recursive child selection)))))
+        (when magit-diff-highlight-hunk-body
+          (magit-section-make-overlay (1- end) end 'magit-section-highlight)))
+    (magit-section-highlight section nil)))
 
 (defun magit-diff-highlight-file (section &optional selection)
   (magit-diff-highlight-heading section selection)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]