fix: renaming buffers doesn't interfere with directory hijack (#25)

This commit is contained in:
Steven Arcangeli 2023-01-10 22:08:59 -08:00
parent 80f64dd630
commit b4ccc16944
3 changed files with 45 additions and 15 deletions

View file

@ -556,7 +556,11 @@ M.setup = function(opts)
loading.set_loading(bufnr, true)
local function finish(new_url)
if new_url ~= params.file then
util.rename_buffer(bufnr, new_url)
if util.rename_buffer(bufnr, new_url) then
-- If the buffer was replaced then don't initialize it. It's dead. The replacement will
-- have BufReadCmd called for it
return
end
end
vim.cmd.doautocmd({ args = { "BufReadPre", params.file }, mods = { emsg_silent = true } })
view.initialize(bufnr)