fix(sidebar): reset cursor to beginning of prompt on submit (#1213)

This fix is required for users with vim.o.virtualedit="all". Otherwise,
the cursor remains at the end of the prompt and has to be manually moved
back before entering the next prompt.
This commit is contained in:
Thomas Müller 2025-02-11 04:36:19 +01:00 committed by GitHub
parent 8d82abe043
commit a6ae8ad4b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1988,6 +1988,7 @@ function Sidebar:create_input_container(opts)
local request = table.concat(lines, "\n")
if request == "" then return end
api.nvim_buf_set_lines(self.input_container.bufnr, 0, -1, false, {})
api.nvim_win_set_cursor(self.input_container.winid, { 1, 0 })
handle_submit(request)
end