summaryrefslogtreecommitdiff
path: root/main.lua
diff options
context:
space:
mode:
Diffstat (limited to 'main.lua')
-rw-r--r--main.lua29
1 files changed, 21 insertions, 8 deletions
diff --git a/main.lua b/main.lua
index 8d7f40f..c811db1 100644
--- a/main.lua
+++ b/main.lua
@@ -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