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

This commit is contained in:
Folke Lemaitre authored and GitHub committed 2025-11-04 13:51:37 -05:00
1 parent b80d390765
commit 20a392fe38
1 file changed
+3 -1
+3 -1
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],
})