fix: error when non-current oil buffer has validation errors (#561)
This commit is contained in:
parent
09fa1d22f5
commit
8d11a2abf3
1 changed files with 7 additions and 4 deletions
|
|
@ -553,10 +553,13 @@ M.try_write_changes = function(confirm, cb)
|
|||
{ all_errors[curbuf][1].lnum + 1, all_errors[curbuf][1].col }
|
||||
)
|
||||
else
|
||||
---@diagnostic disable-next-line: param-type-mismatch
|
||||
local bufnr, errs = next(pairs(all_errors))
|
||||
vim.api.nvim_win_set_buf(0, bufnr)
|
||||
pcall(vim.api.nvim_win_set_cursor, 0, { errs[1].lnum + 1, errs[1].col })
|
||||
local bufnr, errs = next(all_errors)
|
||||
-- HACK: This is a workaround for the fact that we can't switch buffers in the middle of a
|
||||
-- BufWriteCmd.
|
||||
vim.schedule(function()
|
||||
vim.api.nvim_win_set_buf(0, bufnr)
|
||||
pcall(vim.api.nvim_win_set_cursor, 0, { errs[1].lnum + 1, errs[1].col })
|
||||
end)
|
||||
end
|
||||
unlock()
|
||||
cb("Error parsing oil buffers")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue