From 984d8c34d96af205759f0cceb93d298d0b81d926 Mon Sep 17 00:00:00 2001 From: Athozus Date: Sun, 18 Jun 2023 19:40:11 +0200 Subject: [PATCH] Fix unselect all (9679251) --- ui/events.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ui/events.lua b/ui/events.lua index eead4f5..009a7a2 100644 --- a/ui/events.lua +++ b/ui/events.lua @@ -304,17 +304,19 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) elseif fields.selectall then if formname == "mail:inbox" then + local selected_number = #mail.selected_idxs.inbox[name] mail.selected_idxs.inbox[name] = {} -- reset for select, unselect and not existing mail.selected_idxs.multipleselection[name] = true -- enable as the button were pressed - if #mail.selected_idxs.inbox[name] < #getInbox() then -- then populate it if selection isn't full + if selected_number < #getInbox() then -- then populate it if selection isn't full for _, msg in ipairs(getInbox()) do table.insert(mail.selected_idxs.inbox[name], msg.id) end end elseif formname == "mail:outbox" then + local selected_number = #mail.selected_idxs.outbox[name] mail.selected_idxs.outbox[name] = {} -- reset for select, unselect and not existing mail.selected_idxs.multipleselection[name] = true -- enable as the button were pressed - if #mail.selected_idxs.outbox[name] < #getOutbox() then -- then populate it if selection isn't full + if selected_number < #getOutbox() then -- then populate it if selection isn't full for _, msg in ipairs(getOutbox()) do table.insert(mail.selected_idxs.outbox[name], msg.id) end