Skip to content

Commit

Permalink
fix: "invalid buffer id x" error when renaming a buffer
Browse files Browse the repository at this point in the history
Closes #594
  • Loading branch information
mikavilpas committed Dec 2, 2024
1 parent 4a9717d commit 6884a0f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lua/yazi/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,11 @@ function M.rename_or_close_buffer(instruction)
vim.api.nvim_buf_set_name(instruction.bufnr, instruction.path.filename)
end)
vim.schedule(function()
vim.api.nvim_buf_call(instruction.bufnr, function()
vim.cmd("edit!")
end)
if vim.api.nvim_buf_is_valid(instruction.bufnr) then
vim.api.nvim_buf_call(instruction.bufnr, function()
vim.cmd("edit!")
end)
end
end)
end

Expand Down

0 comments on commit 6884a0f

Please sign in to comment.