From bb13e83b44a9a5c08afdeabe8e5f9ee53035cbe0 Mon Sep 17 00:00:00 2001 From: Calvin Bochulak Date: Tue, 7 Mar 2023 09:39:27 -0700 Subject: [PATCH] fix: clamp maximum portals to available labels --- lua/portal/search.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/portal/search.lua b/lua/portal/search.lua index 6e48801..ea924e4 100644 --- a/lua/portal/search.lua +++ b/lua/portal/search.lua @@ -63,7 +63,7 @@ function Search.open(results, labels, window_options) local windows = {} - local max_index = math.max(unpack(vim.tbl_keys(results))) + local max_index = math.min(math.max(unpack(vim.tbl_keys(results))), #labels) local cur_row = 0 for i = 1, max_index do