summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2025-05-12 19:58:23 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2025-05-12 19:58:23 -0700
commite283d573c927d2b3551e7f0d4cf501f41d524ccf (patch)
tree85a67dd573b20fa43e8a712e66b0f5328e1abf5c
parent6be3624d187e82f65c5fa3d1146102ca5505142d (diff)
downloadmpv-iptv-menu-e283d573c927d2b3551e7f0d4cf501f41d524ccf.tar.gz
mpv-iptv-menu-e283d573c927d2b3551e7f0d4cf501f41d524ccf.tar.xz
add ability to go to option from search results
-rw-r--r--main.lua21
1 files changed, 21 insertions, 0 deletions
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})