Skip to content

Commit 0a3be98

Browse files
committed
fix: apply cursorline highlight only to current line. Fixes #111
1 parent 5d168a2 commit 0a3be98

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lua/tiny-inline-diagnostic/highlights.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ local function create_highlight_groups(colors, blends, transparent)
8484
for severity, name in pairs(SEVERITY_NAMES) do
8585
-- Cursor line highlights
8686
hi[HIGHLIGHT_PREFIX .. name .. "CursorLine"] = {
87-
bg = colors.background,
87+
bg = colors.cursor_line.bg,
8888
fg = colors[string.lower(name)].fg,
8989
italic = colors[string.lower(name)].italic,
9090
}
@@ -162,6 +162,7 @@ function M.setup_highlights(blend, default_hi, transparent)
162162
hint = get_highlight(default_hi.hint),
163163
ok = get_highlight(default_hi.ok),
164164
arrow = get_highlight(default_hi.arrow),
165+
cursor_line = get_highlight("CursorLine"),
165166
}
166167

167168
if not transparent then
@@ -207,7 +208,7 @@ end
207208
function M.get_diagnostic_highlights(blend_factor, diag_ret, curline, index_diag)
208209
local diag_hi, diag_inv_hi, body_hi = M.get_diagnostic_highlights_from_severity(diag_ret.severity)
209210

210-
if index_diag == 1 and blend_factor == 0 then
211+
if (diag_ret.line and diag_ret.line == curline) and index_diag == 1 and blend_factor == 0 then
211212
diag_hi = diag_hi .. "CursorLine"
212213
end
213214

0 commit comments

Comments
 (0)