fix(lsp): fix window to set cursor for inline completion (#36444)

This commit is contained in:
Folke Lemaitre
2025-11-04 19:51:37 +01:00
committed by GitHub
parent b80d390765
commit 20a392fe38

View File

@@ -344,7 +344,9 @@ function Completor:accept(item)
lines
)
local pos = item.range.start:to_cursor()
api.nvim_win_set_cursor(vim.fn.bufwinid(self.bufnr), {
local win = api.nvim_get_current_win()
win = api.nvim_win_get_buf(win) == self.bufnr and win or vim.fn.bufwinid(self.bufnr)
api.nvim_win_set_cursor(win, {
pos[1] + #lines - 1,
(#lines == 1 and pos[2] or 0) + #lines[#lines],
})