summaryrefslogtreecommitdiff
path: root/osd.lua
diff options
context:
space:
mode:
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