fix: another case of incorrect alternate buffers (#60)

This commit is contained in:
Steven Arcangeli 2023-03-05 23:57:58 -08:00
parent 4152810907
commit b36ba91b7a
3 changed files with 30 additions and 0 deletions

View file

@ -81,6 +81,30 @@ a.describe("Alternate buffer", function()
assert.equals("bar", vim.fn.expand("#"))
end)
a.it("preserves alternate when traversing oil dirs", function()
vim.cmd.edit({ args = { "foo" } })
oil.open()
test_util.wait_for_autocmd("BufReadPost")
a.util.sleep(10)
assert.equals("foo", vim.fn.expand("#"))
vim.api.nvim_win_set_cursor(0, { 1, 1 })
oil.select()
test_util.wait_for_autocmd("BufReadPost")
assert.equals("foo", vim.fn.expand("#"))
end)
a.it("preserves alternate when opening preview", function()
vim.cmd.edit({ args = { "foo" } })
oil.open()
test_util.wait_for_autocmd("BufReadPost")
a.util.sleep(10)
assert.equals("foo", vim.fn.expand("#"))
vim.api.nvim_win_set_cursor(0, { 1, 1 })
oil.select({ preview = true })
test_util.wait_for_autocmd("BufReadPost")
assert.equals("foo", vim.fn.expand("#"))
end)
a.describe("floating window", function()
a.it("sets previous buffer as alternate", function()
vim.cmd.edit({ args = { "foo" } })