From e283d573c927d2b3551e7f0d4cf501f41d524ccf Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Mon, 12 May 2025 19:58:23 -0700 Subject: add ability to go to option from search results --- main.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/main.lua b/main.lua index 33b2102..d3d2025 100644 --- a/main.lua +++ b/main.lua @@ -508,6 +508,26 @@ local function favourite_option() update_osd() end +local function goto_option() + local menu = menus[depth] + local opt = menu.options[menu.cursor] + if not opt or not opt.path then + return + end + + for i = 1, #opt.path do + push_group_menu(opt.path[i]) + + local target = i == #opt.path and opt or opt.path[i+1] + for i, v in ipairs(menus[depth].options) do + if v.id == target.id then + set_cursor(i, true) + break + end + end + end +end + local function search_menu_options_build(options, t, path) local menu = menus[depth] local path = path or {} @@ -735,6 +755,7 @@ function bind_menu_keys() bind_key('ENTER', select_option) bind_key('Ctrl+f', favourite_option) + bind_key('g', goto_option) bind_key('UP', cursor_up, {repeatable=true}) bind_key('DOWN', cursor_down, {repeatable=true}) -- cgit v1.2.3-70-g09d2