diff options
| author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2026-01-03 22:59:13 -0800 |
|---|---|---|
| committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2026-01-03 22:59:13 -0800 |
| commit | 82a0d6862c4fd5a73c34e86eb72d07d6a53bb435 (patch) | |
| tree | d21cddfc14cb21562b8367c27d611a2ddd75e8e5 | |
| parent | 45c38d2dc8f27b2c3dff4a4e6bcd24b7e84e9135 (diff) | |
| download | mpv-iptv-menu-82a0d6862c4fd5a73c34e86eb72d07d6a53bb435.tar.gz mpv-iptv-menu-82a0d6862c4fd5a73c34e86eb72d07d6a53bb435.tar.xz | |
fix sorting of resumed searches
| -rw-r--r-- | main.lua | 44 |
1 files changed, 21 insertions, 23 deletions
@@ -201,29 +201,6 @@ local function sort_options(options) end) end -local function toggle_menu_sort() - local menu = menus[depth] - - if not menu.sorted_options then - menu.orig_options = menu.options - menu.sorted_options = util.copy_table(menu.options) - sort_options(menu.sorted_options) - - if menu.search_options then - menu.orig_search_options = menu.search_options - menu.sorted_search_options = util.copy_table( - menu.search_options) - sort_options(menu.sorted_search_options) - end - end - - menu.sorted = not menu.sorted - menu.options = menu.sorted and menu.sorted_options or menu.orig_options - menu.search_options = menu.sorted and menu.sorted_search_options or - menu.orig_search_options - update_osd() -end - local function add_programme(opt, time) if opt.epg_channel_id then local prog = epg:scheduled_programme(opt.epg_channel_id, time) @@ -871,6 +848,27 @@ local function cancel_search() bind_menu_keys() end +local function toggle_menu_sort() + local menu = menus[depth] + local key = menu.type == 'search' and 'search_options' or 'options' + + if not menu['sorted_' .. key] then + menu['orig_' .. key] = menu[key] + menu['sorted_' .. key] = util.copy_table(menu[key]) + sort_options(menu['sorted_' .. key]) + end + + menu.sorted = not menu.sorted + menu[key] = menu.sorted and menu['sorted_' .. key] or + menu['orig_' .. key] + + if menu.type == 'search' then + update_search_matches() + else + update_osd() + end +end + local function bind_key(key, func, opts) -- unique name is needed for removal local i = #key_bindings+1 |
