aboutsummaryrefslogtreecommitdiff
path: root/lisp/magit-section.el
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2025-05-31 14:30:21 +0200
committerJonas Bernoulli <jonas@bernoul.li>2025-05-31 14:30:21 +0200
commit66f3cdaca41a041ff8c3ebcbd97cc9e33843b80c (patch)
tree8d3379035857a3fe834aa846fb258cff64f4a709 /lisp/magit-section.el
parent2e65c16dfe2378e8f722f1f450874f865b94b8a5 (diff)
Bring back a variant of delayed hunk refinement
The old variant broke with [1: 95ee9d8c51], which cannot be fixed simply be reverting that commit, because it was in preparation of subsequent changes, which heavily refactored section highlighting making it both simpler and more generic, and also to improve performance. Delayed hunk refinement conflicts with the former, and due to the latter it might not be necessary anymore. This commit does not fully restore the old behavior. Previously delayed refinement meant that only the current hunk was ever refined; when another section became current, the refinement of the previously current section was removed again. Now, once a hunk has been refined, it remains refined, until the buffer is refreshed. The reason any form of delayed hunk refinement was implemented in the first place, was to avoid the upfront cost of completely refining a large diff. I never considered this a desirable feature; just a kludge that was sadly necessary for performance reasons. IMO the new behavior is an improvement; though always refining all hunks is of course even better, unless it is too slow of course. Closes #5385. 1: 2025-04-26 95ee9d8c5102bc5619f0e2c6d50104cae17b2009 magit-diff-paint-hunk: Only refine if actually painting
Diffstat (limited to 'lisp/magit-section.el')
-rw-r--r--lisp/magit-section.el6
1 files changed, 5 insertions, 1 deletions
diff --git a/lisp/magit-section.el b/lisp/magit-section.el
index 9d486ff..68fb164 100644
--- a/lisp/magit-section.el
+++ b/lisp/magit-section.el
@@ -1770,7 +1770,9 @@ evaluated its BODY. Admittedly that's a bit of a hack."
(magit-section-highlight-range content child-start)))
(mapc #'magit-section-highlight children))
((and content (not (slot-boundp section 'painted)))
- (magit-section-highlight-range content end))))
+ (magit-section-highlight-range content end))
+ ;; Unfortunate kludge for delayed hunk refinement.
+ ((magit-section--refine section))))
(headlight
(magit-section-highlight-range start (or content end) headlight)
(when content
@@ -1845,6 +1847,8 @@ evaluated its BODY. Admittedly that's a bit of a hack."
(cl-pushnew section magit-section-highlighted-sections))
(magit-section-update-paint section (magit-focused-sections)))))
+(cl-defmethod magit-section--refine ((_section magit-section)))
+
;;; Long Lines
(defvar magit-show-long-lines-warning t)