Skip to content

Commit 45b9b01

Browse files
committed
refactor: replace deprecated nvim_buf_add_highlight call
With a call to `nvim_buf_set_extmark`.
1 parent fec63d4 commit 45b9b01

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lua/wincent/commandt/private/window.lua

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,15 @@ function Window:highlight_line(index)
140140
vim.api.nvim_win_set_cursor(self._main_window, { index, 0 })
141141
end
142142
if self._main_buffer then
143-
vim.api.nvim_buf_add_highlight(
143+
vim.api.nvim_buf_set_extmark(
144144
self._main_buffer,
145145
self._namespace,
146-
self._selection_highlight,
147146
index - 1, -- line (0-indexed)
148147
0, -- col_start
149-
-1 -- col_end (end-of-line)
148+
{
149+
end_col = #vim.api.nvim_buf_get_lines(self._main_buffer, index - 1, index, false)[1],
150+
hl_group = self._selection_highlight,
151+
}
150152
)
151153
end
152154
end

0 commit comments

Comments
 (0)