feat(extmark): virt_lines can highlight until EOL #41289

This commit is contained in:
Goldpigg
2026-08-18 20:35:22 +08:00
committed by GitHub
parent 1eae512285
commit ab82c2c6b0
7 changed files with 101 additions and 7 deletions

View File

@@ -671,7 +671,8 @@ function vim.api.nvim_buf_line_count(buf) end
--- display of the text, except 'tabstop' is used for hard tabs. The 'wrap' and
--- 'linebreak' options do not take effect, so the number of extra screen lines will
--- match the list-size (but see `virt_lines_overflow`). By default lines are placed
--- below the marked line.
--- below the marked line. Special case: If the last `text_chunk` is empty,
--- the corresponding `hl` will extend to the end of the line.
--- - virt_lines_above: Place virtual lines above instead.
--- - virt_lines_leftcol: Place virtual lines in the leftmost column of the window,
--- bypassing sign and number columns.

View File

@@ -247,6 +247,12 @@ function Completor:show(hint)
col = col + skip - 1
local virt_lines = { unpack(lines, 2) }
for i, s in ipairs(virt_lines) do
if #s == 1 and s[1][1] == '' then
virt_lines[i] = {}
end
end
api.nvim_buf_set_extmark(self.bufnr, namespace, row, col, {
virt_text = virt_text,
virt_lines = virt_lines,