From b4896ed69ec537233407d8ae4798167fd3fbe6c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jefferson=20Gonz=C3=A1lez?= Date: Mon, 7 Jun 2021 17:29:03 -0400 Subject: [PATCH] [plugin/contextmenu] Append itemsets that where registered. (#258) --- data/plugins/contextmenu.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/data/plugins/contextmenu.lua b/data/plugins/contextmenu.lua index 6a14d049..a23d59cf 100644 --- a/data/plugins/contextmenu.lua +++ b/data/plugins/contextmenu.lua @@ -64,14 +64,19 @@ end function ContextMenu:show(x, y) self.items = nil + local items_list = { width = 0, height = 0 } for _, items in ipairs(self.itemset) do if items.predicate(x, y) then - self.items = items.items - break + items_list.width = math.max(items_list.width, items.items.width) + items_list.height = items_list.height + items.items.height + for _, subitems in ipairs(items.items) do + table.insert(items_list, subitems) + end end end - if self.items then + if #items_list > 0 then + self.items = items_list local w, h = self.items.width, self.items.height -- by default the box is opened on the right and below