fix(buffer): guard ViewContext line_hl against neogit_disable_hunk_highlight#1904
Open
barrettruth wants to merge 1 commit intoNeogitOrg:masterfrom
Open
fix(buffer): guard ViewContext line_hl against neogit_disable_hunk_highlight#1904barrettruth wants to merge 1 commit intoNeogitOrg:masterfrom
barrettruth wants to merge 1 commit intoNeogitOrg:masterfrom
Conversation
…ghlight Problem: ViewContext on_win applied NeogitDiffContextHighlight as line_hl_group on all lines in the cursor's section, overriding third- party plugin backgrounds regardless of extmark priority. Solution: skip the per-line highlight when neogit_disable_hunk_highlight is set, preserving only the cursor-line indicator.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When
neogit_disable_hunk_highlight = trueis set on a buffer (introducedin #1897 for third-party plugin interop), the
HunkLinerenderer correctlyskips its own highlights — but the
ViewContextdecoration provider'son_wincallback was still applyingNeogitDiffContextHighlightasline_hl_groupon every visible line in the cursor's section. Becauseline_hl_groupoperates on a separate stacking layer, it overridesthird-party backgrounds (e.g.
DiffsAdd/DiffsDeletefrom diffs.nvim)regardless of extmark priority, making them invisible.
Solution
Check
neogit_disable_hunk_highlightper-line inside the ViewContext loop.When set, skip
add_line_highlightfor non-cursor lines. The cursor-lineindicator (
NeogitDiffContextCursorHighlight) is preserved.