From 4c4911eb4fcc644c8c0f9ae3945976106defe0f9 Mon Sep 17 00:00:00 2001 From: Jean-Patrick Guerrero Date: Sun, 25 Sep 2022 16:55:24 +0200 Subject: [PATCH] Fix --- src/fields.lua | 14 +++++++------- src/gui.lua | 4 ++++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/fields.lua b/src/fields.lua index b007d95..e21441d 100644 --- a/src/fields.lua +++ b/src/fields.lua @@ -294,13 +294,13 @@ local function select_item(player, data, fields) if item == data.query_item then return end local recipes, usages = get_recipes(player, item) - data.query_item = item - data.recipes = recipes - data.usages = usages - data.rnum = 1 - data.unum = 1 - data.scrbar_rcp = 1 - data.scrbar_usg = 1 + data.query_item = item + data.recipes = recipes + data.usages = usages + data.rnum = 1 + data.unum = 1 + data.scrbar_rcp = 1 + data.scrbar_usg = 1 data.crafting_rcp = nil data.crafting_usg = nil end diff --git a/src/gui.lua b/src/gui.lua index fde898f..b881690 100644 --- a/src/gui.lua +++ b/src/gui.lua @@ -1491,6 +1491,10 @@ local function get_items_fs(fs, data, player, full_height) data.pagemax = max(1, ceil(#items / ipp)) + if data.pagenum > data.pagemax then + data.pagenum = data.pagemax + end + if #items == 0 then local lbl = ES"No item to show" local icon, width, offset = PNG.no_result, 4, 2