fix: warning when :tabnew from oil buffer (#40)
This commit is contained in:
parent
ca4da68aae
commit
73c6fcf519
2 changed files with 20 additions and 1 deletions
|
|
@ -705,7 +705,9 @@ M.setup = function(opts)
|
||||||
-- This new window is a split off of an oil window. We need to transfer the window
|
-- This new window is a split off of an oil window. We need to transfer the window
|
||||||
-- variables. First, locate the parent window
|
-- variables. First, locate the parent window
|
||||||
local parent_win
|
local parent_win
|
||||||
for _, winid in ipairs(vim.api.nvim_tabpage_list_wins(0)) do
|
-- First search windows in this tab, then search all windows
|
||||||
|
local winids = vim.list_extend(vim.api.nvim_tabpage_list_wins(0), vim.api.nvim_list_wins())
|
||||||
|
for _, winid in ipairs(winids) do
|
||||||
if vim.api.nvim_win_is_valid(winid) then
|
if vim.api.nvim_win_is_valid(winid) then
|
||||||
if vim.w[winid].oil_did_enter then
|
if vim.w[winid].oil_did_enter then
|
||||||
parent_win = winid
|
parent_win = winid
|
||||||
|
|
|
||||||
|
|
@ -40,4 +40,21 @@ a.describe("window options", function()
|
||||||
vim.cmd.edit({ args = { "README.md" } })
|
vim.cmd.edit({ args = { "README.md" } })
|
||||||
assert.equals("auto", vim.o.signcolumn)
|
assert.equals("auto", vim.o.signcolumn)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
a.it("Restores window options on tabnew <filename>", function()
|
||||||
|
oil.open()
|
||||||
|
test_util.wait_for_autocmd("BufReadPost")
|
||||||
|
assert.equals("no", vim.o.signcolumn)
|
||||||
|
vim.cmd.tabnew({ args = { "README.md" } })
|
||||||
|
assert.equals("auto", vim.o.signcolumn)
|
||||||
|
end)
|
||||||
|
|
||||||
|
a.it("Restores window options on tabnew", function()
|
||||||
|
oil.open()
|
||||||
|
test_util.wait_for_autocmd("BufReadPost")
|
||||||
|
assert.equals("no", vim.o.signcolumn)
|
||||||
|
vim.cmd.tabnew()
|
||||||
|
vim.cmd.edit({ args = { "README.md" } })
|
||||||
|
assert.equals("auto", vim.o.signcolumn)
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue