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 committed Sep 23, 2023
1 parent 5710a58 commit b145c26
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions memo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ function menu_json(menu_items, page)
type = "memo-history",
title = title,
items = menu_items,
on_search = {"script-message-to", script_name, "memo-search-uosc:"},
search_debounce = 0,
on_close = {"script-message-to", script_name, "memo-clear"}
}

Expand Down Expand Up @@ -940,8 +942,18 @@ 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
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 b145c26

Please sign in to comment.