diff options
| -rw-r--r-- | main.lua | 28 |
1 files changed, 10 insertions, 18 deletions
@@ -655,17 +655,13 @@ local function search_menu_options_build(options, t, path) local path = path or {} for _, v in ipairs(options) do - if not v.type then - goto continue - end - - if not t[v.type] then - t[v.type] = {} - end - local v = util.copy_table(v) v.path = path - t[v.type][#t[v.type]+1] = v + if v.type == 'group' and v.group_type ~= 'series' then + t.categories[#t.categories+1] = v + else + t.elements[#t.elements+1] = v + end -- contents of lazy-loaded groups should not be searchable if v.type == 'group' and not v.lazy then @@ -674,21 +670,17 @@ local function search_menu_options_build(options, t, path) search_menu_options_build( group_menu_options(v), t, path) end - - ::continue:: end end local function search_menu_options(options) - local t = {} + local t = {categories = {}, elements = {}} search_menu_options_build(options, t) - -- display categories before streams - local ret = t.group or {} - if t.stream then - for _, v in ipairs(t.stream) do - ret[#ret+1] = v - end + -- display categories first + local ret = t.categories + for _, v in ipairs(t.elements) do + ret[#ret+1] = v end return ret end |
