diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2025-05-06 18:17:05 -0700 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2025-05-06 18:17:05 -0700 |
commit | 904a1d8a992029d07eb9ab99df1c00eca44f891c (patch) | |
tree | d331f56401d79643953f6aceffa33af5a70f126f /main.lua | |
parent | 8700155980e3a742064d095c9958fa5a843e2582 (diff) | |
download | mpv-iptv-menu-904a1d8a992029d07eb9ab99df1c00eca44f891c.tar.gz mpv-iptv-menu-904a1d8a992029d07eb9ab99df1c00eca44f891c.tar.xz |
allow resuming previous search
Diffstat (limited to 'main.lua')
-rw-r--r-- | main.lua | 29 |
1 files changed, 21 insertions, 8 deletions
@@ -147,14 +147,18 @@ local function last_option() advance_cursor(math.huge) end -local function push_menu(options, title) - menu = { +local function push_menu(t) + local menu = { + options={}, title=title, - options=options or {}, cursor_pos=1, page_pos=1, } + for k, v in pairs(t) do + menu[k] = v + end + depth = depth + 1 menus[depth] = menu end @@ -172,7 +176,7 @@ local function add_category_menu(category_id, category_name) end end - push_menu(options, category_name) + push_menu({options=options, title=category_name}) update_osd() end @@ -289,11 +293,20 @@ local bind_menu_keys local function search_start() search_active = true - search_text = '' - search_text_cursor = 1 - push_menu() - search_update() + local menu = menus[depth] + if menu.type == 'search' then + search_text_cursor = #search_text + 1 + menu.cursor_pos = 1 + menu.page_pos = 1 + search_update_osd() + else + search_text = '' + search_text_cursor = 1 + push_menu({type='search'}) + search_update() + end + bind_search_keys() end |