refactor: only gc oil buffers once all oil bufs are hidden

Previously we were gc-ing all hidden oil buffers 2 seconds after they
were hidden. I think this is a little too magical, and interferes with
some expected vim behavior (ctrl-o/i). If people want the old behavior,
we can expose the "GC hidden buffers" function via the API.

We're also changing the "rerender visible oil buffers" logic, because
previously that would delete hidden oil buffers. Now it simply marks
them as dirty, and they will be rerendered during the next BufEnter.
This commit is contained in:
Steven Arcangeli 2023-02-24 07:29:09 -08:00
parent f1131b5e90
commit 0b2a4ddde1
2 changed files with 45 additions and 17 deletions

View file

@ -511,7 +511,7 @@ M.try_write_changes = function(confirm)
vim.split(current_entry.name, "/")[1]
)
end
view.rerender_visible_and_cleanup({ preserve_undo = M.trash })
view.rerender_all_oil_buffers({ preserve_undo = M.trash })
end
end)
)