diff --git a/player/lua/console.lua b/player/lua/console.lua index f13656a6b4..62180eb303 100644 --- a/player/lua/console.lua +++ b/player/lua/console.lua @@ -1787,7 +1787,13 @@ mp.register_script_message('get-input', function (script_name, args) matches = {} selected_match = args.default_item or 1 default_item = args.default_item - first_match_to_print = 1 + + local max_lines = calculate_max_log_lines() + first_match_to_print = math.max(1, selected_match - math.floor(max_lines / 2) + 2) + if first_match_to_print > #selectable_items - max_lines + 2 then + first_match_to_print = math.max(1, #selectable_items - max_lines + 2) + end + for i, item in ipairs(selectable_items) do matches[i] = { index = i, text = item } end