-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Hi,
I'm using magit-diff-refine-hunk
set to all
, which highlights changed/removed words inside of diff lines.
When this option is used inside pr-review
buffer, and when there is a comment inside an area highlighted by the refined hunk mode, a fontification bug can happen.
Normally my in-diff blocks are rendering like this:
But if such block overlaps with refined highlighting, it looks like this:
Here, "PENDING COMMENT" and "Test comment" should have blue background, but they are green instead.
(Screenshots are taken from my fork in #11, but I think it doesn't matter in this case, see below.)
This happens because pr-review applies fontification using text properties, and refined highlighting is done using overlays, which take precedence over properties:
Text content at position 175792:
There is an overlay here:
From 175585 to 176028
diff-mode fine
evaporate t
face diff-refine-added
There are text properties here:
face pr-review-in-diff-pending-begin-face
font-lock-face magit-diff-context
pr-review-pending-review-thread [Show]
Here, diff-refine-added
is applied to a wider area (the whole comment block is inside that area), and takes priority over pr-review-in-diff-pending-begin-face
. Hence background becomes green instead of blue.
One solution is to teach pr-review
to use overlays instead of text properties. This way it can control priorities precisely.
I think this approach makes sense - pr-review
works "on top" of magit sections, and inserts its own blocks inside them. Hence it would be logical if pr-review
fontification would also work "on top" of original magit fontification - which AFAIK can be achieved only using overlays.
Let me know what do you think about this approach. If you think it makes sense I can try to prepare a patch that uses overlays instead of text properties.