fix(highlight): use diffAdded/diffRemoved fg for char-level backgrounds

The previous 70% alpha blend of DiffAdd bg was nearly identical to the
40% line-level blend, making char-level highlights invisible. Now blends
the bright diffAdded/diffRemoved foreground color (same base as line
number fg) into the char-level bg, matching GitHub/VSCode intensity.

Also bumps intra.max_lines default from 200 to 500.
This commit is contained in:
Barrett Ruth 2026-02-06 14:43:23 -05:00
parent 63b6e7d4c6
commit f1c13966ba
2 changed files with 13 additions and 12 deletions

View file

@ -62,12 +62,12 @@ Configuration is done via `vim.g.diffs`. Set this before the plugin loads:
},
vim = {
enabled = false,
max_lines = 200,
max_lines = 500,
},
intra = {
enabled = true,
algorithm = 'auto',
max_lines = 200,
max_lines = 500,
},
},
fugitive = {
@ -165,7 +165,7 @@ Configuration is done via `vim.g.diffs`. Set this before the plugin loads:
`vim.diff()`. `'vscode'`: require libvscodediff
(falls back to native if not available).
{max_lines} (integer, default: 200)
{max_lines} (integer, default: 500)
Skip character-level highlighting for hunks larger
than this many lines.
@ -382,15 +382,16 @@ Fugitive unified diff highlights: ~
*DiffsAddText*
DiffsAddText Character-level background for changed characters
within `+` lines. Derived by blending `DiffAdd`
background with `Normal` at 70% alpha (brighter
than line-level `DiffsAdd`). Only sets `bg`, so
treesitter foreground colors show through.
within `+` lines. Derived by blending `diffAdded`
foreground with `Normal` background at 40% alpha.
Uses the same base color as `DiffsAddNr` foreground,
making changed characters clearly visible. Only sets
`bg`, so treesitter foreground colors show through.
*DiffsDeleteText*
DiffsDeleteText Character-level background for changed characters
within `-` lines. Derived by blending `DiffDelete`
background with `Normal` at 70% alpha.
within `-` lines. Derived by blending `diffRemoved`
foreground with `Normal` background at 40% alpha.
Diff mode window highlights: ~
These are used for |winhighlight| remapping in `&diff` windows.

View file

@ -91,7 +91,7 @@ local default_config = {
intra = {
enabled = true,
algorithm = 'auto',
max_lines = 200,
max_lines = 500,
},
},
fugitive = {
@ -183,8 +183,8 @@ local function compute_highlight_groups()
local blended_add = blend_color(add_bg, bg, 0.4)
local blended_del = blend_color(del_bg, bg, 0.4)
local blended_add_text = blend_color(add_bg, bg, 0.7)
local blended_del_text = blend_color(del_bg, bg, 0.7)
local blended_add_text = blend_color(add_fg, bg, 0.4)
local blended_del_text = blend_color(del_fg, bg, 0.4)
vim.api.nvim_set_hl(0, 'DiffsAdd', { default = true, bg = blended_add })
vim.api.nvim_set_hl(0, 'DiffsDelete', { default = true, bg = blended_del })