fix: edge case where window options were not set
This commit is contained in:
parent
90622106cd
commit
b8eaf88c12
2 changed files with 16 additions and 0 deletions
|
|
@ -742,6 +742,10 @@ M.setup = function(opts)
|
|||
if has_orig and vim.api.nvim_buf_is_valid(orig_buffer) then
|
||||
vim.fn.setreg("#", orig_buffer)
|
||||
end
|
||||
if not vim.w.oil_did_enter then
|
||||
require("oil.view").set_win_options()
|
||||
vim.w.oil_did_enter = true
|
||||
end
|
||||
elseif vim.fn.isdirectory(bufname) == 0 then
|
||||
-- Only run this logic if we are *not* in an oil buffer (and it's not a directory, which
|
||||
-- will be replaced by an oil:// url)
|
||||
|
|
|
|||
|
|
@ -57,4 +57,16 @@ a.describe("window options", function()
|
|||
vim.cmd.edit({ args = { "README.md" } })
|
||||
assert.equals("auto", vim.o.signcolumn)
|
||||
end)
|
||||
|
||||
a.it("Sets the window options when re-entering oil buffer", function()
|
||||
oil.open()
|
||||
test_util.wait_for_autocmd("BufReadPost")
|
||||
assert.truthy(vim.w.oil_did_enter)
|
||||
vim.cmd.edit({ args = { "README.md" } })
|
||||
assert.falsy(vim.w.oil_did_enter)
|
||||
oil.open()
|
||||
assert.truthy(vim.w.oil_did_enter)
|
||||
vim.cmd.vsplit()
|
||||
assert.truthy(vim.w.oil_did_enter)
|
||||
end)
|
||||
end)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue