summaryrefslogtreecommitdiff
path: root/osd.lua
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2026-02-06 12:30:32 -0800
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2026-02-06 12:30:32 -0800
commite1f7209131cafab74f0665599a13d668ebeb410c (patch)
tree33d7d8c0beb9d91a5bd7ab5b51d4e1389ce97794 /osd.lua
parentef41e8c9a54119628aa8cffb193e42782e69563f (diff)
downloadmpv-iptv-menu-e1f7209131cafab74f0665599a13d668ebeb410c.tar.gz
mpv-iptv-menu-e1f7209131cafab74f0665599a13d668ebeb410c.tar.xz
implement global EPG search
Diffstat (limited to 'osd.lua')
-rw-r--r--osd.lua40
1 files changed, 5 insertions, 35 deletions
diff --git a/osd.lua b/osd.lua
index 2152863..0e06f22 100644
--- a/osd.lua
+++ b/osd.lua
@@ -155,44 +155,14 @@ function mt:menu_lines(state)
end
function mt:menu_title(menu)
- local str = asscape(menu.title)
+ local str, has_tags = menu:get_title()
+ str = asscape(str)
local col = menu.search_active and colour.selected or colour.title
- if menu.type == 'search' then
- local start = #menu.search_text - #menu.search_term
- local prefix = menu.search_text:sub(1, start)
- local term = menu.search_text:sub(start + 1)
-
- if str:find('<text>', 1, true) then
- str = str:gsub('<text>', function()
- return colour.search_prefix ..
- asscape(prefix) .. col .. asscape(term)
- end)
- end
-
- if str:find('<text_with_cursor>', 1, true) then
- local idx = menu.search_cursor
- if idx <= start then
- prefix = asscape(prefix:sub(1, idx - 1)) ..
- col .. cursor_glyph ..
- colour.search_prefix ..
- asscape(prefix:sub(idx))
- term = asscape(term)
- else
- idx = idx - start
- prefix = asscape(prefix)
- term = asscape(term:sub(1, idx - 1)) ..
- cursor_glyph .. asscape(term:sub(idx))
- end
- str = str:gsub('<text_with_cursor>', function()
- return colour.search_prefix .. prefix .. col ..
- term
- end)
- end
-
+ if has_tags then
+ str = str:gsub('<cursor>', cursor_glyph)
str = str:gsub('<colour%.(.-)>', colour)
- str = str:gsub('<num_matches>', #menu.options)
- str = str:gsub('<num_total>', #menu.search_options)
+ str = str:gsub('<reset_colour>', col)
end
if menu:is_sorted() then