fix(#2191): edit: disregard floating windows (#2209)

This commit is contained in:
Alexander Courtis 2023-05-14 11:30:01 +10:00 committed by GitHub
parent 498e8793bb
commit 89816ace70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -237,7 +237,12 @@ local function open_in_new_window(filename, mode)
return return
end end
local win_ids = vim.api.nvim_list_wins() -- non-floating windows
local win_ids = vim.tbl_filter(function(id)
local config = vim.api.nvim_win_get_config(id)
return config and config.relative == ""
end, vim.api.nvim_list_wins())
local create_new_window = #win_ids == 1 -- This implies that the nvim-tree window is the only one local create_new_window = #win_ids == 1 -- This implies that the nvim-tree window is the only one
local new_window_side = (view.View.side == "right") and "aboveleft" or "belowright" local new_window_side = (view.View.side == "right") and "aboveleft" or "belowright"