From 5e69e25df6ef735be6e703456ceabedd4d2529ed Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Mon, 5 May 2025 14:10:56 -0700 Subject: display selected category --- main.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/main.lua b/main.lua index 25d53f8..76fc7b8 100644 --- a/main.lua +++ b/main.lua @@ -23,12 +23,16 @@ local menu_pos = {1} function update_osd() local out = {} + for i = 1, depth - 1 do + out[#out+1] = '{\\c&H999999&}[' .. + menus[i][menu_pos[i]]['category_name'] .. ']{\\c}' + end for i = menu_top[depth], math.min( - menu_top[depth] + osd_lines - 1, #menus[depth]) do + menu_top[depth] + osd_lines - depth, #menus[depth]) do local key = (depth == 1 and 'category_name' or 'name') local str = menus[depth][i][key] if i == menu_pos[depth] then - str = '{\\c&HFF00&}* ' .. str .. '{\\c&HFFFFFF&}' + str = '{\\c&HFF00&}* ' .. str .. '{\\c}' end out[#out+1] = str end @@ -56,7 +60,7 @@ function handle_down() end menu_pos[depth] = menu_pos[depth] + 1 - if menu_pos[depth] > menu_top[depth] + osd_lines - 1 then + if menu_pos[depth] > menu_top[depth] + osd_lines - depth then menu_top[depth] = menu_top[depth] + 1 end -- cgit v1.2.3-70-g09d2