From 9c60947926e5fb8a04f9fb8d798a1a7ff9126992 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sun, 30 Apr 2023 15:56:46 +1000 Subject: [PATCH] fix(#2175): check number of actions.open_file.window_picker.chars before picking window (#2177) --- lua/nvim-tree/actions/node/open-file.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lua/nvim-tree/actions/node/open-file.lua b/lua/nvim-tree/actions/node/open-file.lua index 00908576..6990c896 100644 --- a/lua/nvim-tree/actions/node/open-file.lua +++ b/lua/nvim-tree/actions/node/open-file.lua @@ -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 = {}