fix: oil buffers remain unmodified after saving changes
This commit is contained in:
parent
eea34329e8
commit
931453fc09
3 changed files with 63 additions and 2 deletions
|
|
@ -1,8 +1,15 @@
|
|||
require("plenary.async").tests.add_to_env()
|
||||
local cache = require("oil.cache")
|
||||
local M = {}
|
||||
|
||||
M.reset_editor = function()
|
||||
require("oil").setup({})
|
||||
require("oil").setup({
|
||||
columms = {},
|
||||
adapters = {
|
||||
["oil-test://"] = "test",
|
||||
},
|
||||
silence_disclaimer = true,
|
||||
})
|
||||
vim.cmd.tabonly({ mods = { silent = true } })
|
||||
for i, winid in ipairs(vim.api.nvim_tabpage_list_wins(0)) do
|
||||
if i > 1 then
|
||||
|
|
@ -13,6 +20,7 @@ M.reset_editor = function()
|
|||
for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do
|
||||
vim.api.nvim_buf_delete(bufnr, { force = true })
|
||||
end
|
||||
cache.clear_everything()
|
||||
end
|
||||
|
||||
M.wait_for_autocmd = a.wrap(function(autocmd, cb)
|
||||
|
|
@ -24,4 +32,21 @@ M.wait_for_autocmd = a.wrap(function(autocmd, cb)
|
|||
})
|
||||
end, 2)
|
||||
|
||||
---@param actions string[]
|
||||
---@param timestep integer
|
||||
M.feedkeys = function(actions, timestep)
|
||||
timestep = timestep or 10
|
||||
a.util.sleep(timestep)
|
||||
for _, action in ipairs(actions) do
|
||||
a.util.sleep(timestep)
|
||||
local escaped = vim.api.nvim_replace_termcodes(action, true, false, true)
|
||||
vim.api.nvim_feedkeys(escaped, "m", true)
|
||||
end
|
||||
a.util.sleep(timestep)
|
||||
-- process pending keys until the queue is empty.
|
||||
-- Note that this will exit insert mode.
|
||||
vim.api.nvim_feedkeys("", "x", true)
|
||||
a.util.sleep(timestep)
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue