Skip to content

Commit

Permalink
Add support for uosc menu search
Browse files Browse the repository at this point in the history
  • Loading branch information
christoph-heinrich authored and po5 committed Oct 26, 2023
1 parent bc4a95f commit 218234e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion memo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,8 @@ function menu_json(menu_items, page)
type = "memo-history",
title = title,
items = menu_items,
on_close = {"script-message-to", script_name, "memo-clear"}
on_search = { "script-message-to", script_name, "memo-search-uosc:" },
on_close = { "script-message-to", script_name, "memo-clear" }
}

return menu
Expand Down Expand Up @@ -1030,8 +1031,19 @@ function memo_search(...)
show_history(options.entries, false)
end

function memo_search_uosc(query)
search_query = query
search_words = {}
for m in query:lower():gmatch('%S+') do
search_words[#search_words + 1] = m
end
event_loop_exhausted = false
show_history(options.entries, false, false, menu_shown and last_state)
end

mp.register_script_message("memo-clear", memo_clear)
mp.register_script_message("memo-search:", memo_search)
mp.register_script_message("memo-search-uosc:", memo_search_uosc)

mp.command_native_async({"script-message-to", "uosc", "get-version", script_name}, function() end)

Expand Down

0 comments on commit 218234e

Please sign in to comment.