fix(#2175): check number of actions.open_file.window_picker.chars before picking window (#2177)

This commit is contained in:
Alexander Courtis 2023-04-30 15:56:46 +10:00 committed by GitHub
parent d8b154c5f0
commit 9c60947926
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,6 @@
-- Copyright 2019 Yazdani Kiyan under MIT License
local lib = require "nvim-tree.lib"
local notify = require "nvim-tree.notify"
local utils = require "nvim-tree.utils"
local view = require "nvim-tree.view"
@ -60,6 +61,17 @@ local function pick_win_id()
return selectable[1]
end
if #M.window_picker.chars < #selectable then
notify.error(
string.format(
"More windows (%d) than actions.open_file.window_picker.chars (%d) - please add more.",
#selectable,
#M.window_picker.chars
)
)
return nil
end
local i = 1
local win_opts = {}
local win_map = {}