Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions lua/nvim-tree/actions/node/open-file.lua
Original file line number Diff line number Diff line change
@@ -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"

Expand Down Expand Up @@ -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 = {}
Expand Down