aboutsummaryrefslogtreecommitdiff
path: root/lisp/magit-diff.el
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2026-04-11 16:52:58 +0200
committerJonas Bernoulli <jonas@bernoul.li>2026-04-11 16:52:58 +0200
commit68cfa77319b6935773b4882f92e092024eb8b8f8 (patch)
tree8e65f8398ab95674a4618936f9e7ba8a76ee9f56 /lisp/magit-diff.el
parentb400caeb52fe67419d29713a0f16c8118a56f303 (diff)
Do not attempt to fontify and refine metadata hunks
The new `magit--meta-hunk-p' is a kludge, instead we should define proper types for these "not-quite-a-hunk" sections. Closes #5554.
Diffstat (limited to 'lisp/magit-diff.el')
-rw-r--r--lisp/magit-diff.el21
1 files changed, 12 insertions, 9 deletions
diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el
index 4ccc51b..6caeeec 100644
--- a/lisp/magit-diff.el
+++ b/lisp/magit-diff.el
@@ -3683,10 +3683,11 @@ actually a `diff' but a `diffstat' section."
(magit--add-face-text-property
bol (+ bol (if merging 2 1)) sign-face)))
(forward-line)))
- (when (eq magit-diff-fontify-hunk 'all)
- (magit-diff--update-hunk-syntax section))
- (when (eq magit-diff-refine-hunk 'all)
- (magit-diff-update-hunk-refinement section))
+ (unless (magit--meta-hunk-p section)
+ (when (eq magit-diff-fontify-hunk 'all)
+ (magit-diff--update-hunk-syntax section))
+ (when (eq magit-diff-refine-hunk 'all)
+ (magit-diff-update-hunk-refinement section)))
(oset section painted (if highlight 'highlight 'plain)))
;;;; Whitespace
@@ -3760,10 +3761,11 @@ actually a `diff' but a `diffstat' section."
;;;; Refinement
(cl-defmethod magit-section--refine ((section magit-hunk-section))
- (when (eq magit-diff-fontify-hunk t)
- (magit-diff--update-hunk-syntax section))
- (when (eq magit-diff-refine-hunk t)
- (magit-diff-update-hunk-refinement section)))
+ (unless (magit--meta-hunk-p section)
+ (when (eq magit-diff-fontify-hunk t)
+ (magit-diff--update-hunk-syntax section))
+ (when (eq magit-diff-refine-hunk t)
+ (magit-diff-update-hunk-refinement section))))
(defun magit-diff-update-hunk-refinement (&optional section allow-remove)
(if section
@@ -3820,7 +3822,8 @@ actually a `diff' but a `diffstat' section."
(forward-line 1))))))
(named-let update ((section magit-root-section))
(if (magit-section-match 'hunk section)
- (magit-diff--update-hunk-syntax section)
+ (unless (magit--meta-hunk-p section)
+ (magit-diff--update-hunk-syntax section))
(dolist (child (oref section children))
(update child))))))