fix: alternate buffer preservation (#43)

This commit is contained in:
Steven Arcangeli 2023-01-20 02:56:57 -08:00
parent a60639db35
commit 4e853eabcb
3 changed files with 27 additions and 2 deletions

View file

@ -16,6 +16,19 @@ a.describe("Alternate buffer", function()
assert.equals("foo", vim.fn.expand("#"))
end)
a.it("sets previous buffer as alternate when editing url file", function()
vim.cmd.edit({ args = { "foo" } })
oil.open()
test_util.wait_for_autocmd("BufReadPost")
local readme = fs.join(vim.fn.getcwd(), "README.md")
vim.cmd.edit({ args = { "oil://" .. fs.os_to_posix_path(readme) } })
-- We're gonna jump around to 2 different buffers
test_util.wait_for_autocmd("BufEnter")
test_util.wait_for_autocmd("BufEnter")
assert.equals(readme, vim.api.nvim_buf_get_name(0))
assert.equals("foo", vim.fn.expand("#"))
end)
a.it("sets previous buffer as alternate when editing oil://", function()
vim.cmd.edit({ args = { "foo" } })
vim.cmd.edit({ args = { "oil://" .. fs.os_to_posix_path(vim.fn.getcwd()) } })