Skip to content

Commit 3255aaf

Browse files
committed
fix(highlights): respect cursorline setting for highlights
1 parent c88e6fe commit 3255aaf

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lua/tiny-inline-diagnostic/highlights.lua

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,17 +133,24 @@ end
133133
function M.get_diagnostic_highlights(blend_factor, diag_ret, curline, index_diag)
134134
local diag_hi, diag_inv_hi, body_hi = M.get_diagnostic_highlights_from_severity(diag_ret.severity)
135135

136-
if (diag_ret.line and diag_ret.line == curline) and index_diag == 1 then
136+
local is_cursorline_enabled = vim.opt.cursorline:get()
137+
138+
if
139+
(diag_ret.line and diag_ret.line == curline)
140+
and index_diag == 1
141+
and not diag_ret.need_to_be_under
142+
then
137143
if blend_factor == 0 then
138144
diag_hi = diag_hi .. "CursorLine"
145+
diag_inv_hi = diag_inv_hi .. "CursorLine"
139146
end
140-
diag_inv_hi = diag_inv_hi .. "CursorLine"
141147
end
142148

143149
if
144150
(diag_ret.line and diag_ret.line ~= curline)
145151
or index_diag > 1
146152
or diag_ret.need_to_be_under
153+
or not is_cursorline_enabled
147154
then
148155
diag_inv_hi = diag_inv_hi .. "NoBg"
149156
end

0 commit comments

Comments
 (0)