Compare commits

...

3 Commits

Author SHA1 Message Date
0de66b1a09 Small cleanup 2020-09-07 00:57:57 +02:00
aa46556020 Fix tooltip 2 2020-08-31 22:46:30 +02:00
ce59bd35d4 Fix tooltip 2020-08-31 15:07:39 +02:00

View File

@ -819,19 +819,15 @@ local function is_fav(favs, query_item)
end end
local function weird_desc(str) local function weird_desc(str)
return not true_str(str) or find(str, "[\\]*") or not find(str, "%u") return not true_str(str) or find(str, "\n") or not find(str, "%u")
end end
local function toupper(str) local function toupper(str)
return str:gsub("%f[%w]%l", upper):gsub("_", " ") return str:gsub("%f[%w]%l", upper):gsub("_", " ")
end end
local function strip_newline(str) local function nice_strip(str, limit)
return match(str, "[^\n]*") return #str > limit and fmt("%s...", sub(str, 1, limit - 3)) or str
end
local function strip_prefix(str)
return match(str, ".*@.*%)(.*)()") or str
end end
local function get_desc(item) local function get_desc(item)
@ -844,9 +840,7 @@ local function get_desc(item)
if def then if def then
local desc = def.description local desc = def.description
if true_str(desc) then if true_str(desc) then
desc = desc:trim() desc = desc:trim():match("[^\n]*")
desc = strip_newline(desc)
desc = strip_prefix(desc)
if not find(desc, "%u") then if not find(desc, "%u") then
desc = toupper(desc) desc = toupper(desc)
@ -1109,13 +1103,7 @@ local function get_grid_fs(fs, rcp, spacing)
fs[#fs + 1] = fmt(FMT.image, X, Y, btn_size, btn_size, PNG.selected) fs[#fs + 1] = fmt(FMT.image, X, Y, btn_size, btn_size, PNG.selected)
end end
local btn_name = "" local btn_name = groups and fmt("group|%s|%s", groups[1], item) or item
if groups then
btn_name = fmt("group|%s|%s", groups[1], item)
elseif item ~= "" then
btn_name = item
end
fs[#fs + 1] = fmt(FMT.item_image_button, fs[#fs + 1] = fmt(FMT.item_image_button,
X, Y, btn_size, btn_size, item, btn_name, label) X, Y, btn_size, btn_size, item, btn_name, label)
@ -1187,15 +1175,10 @@ local function get_rcp_lbl(fs, data, panel, spacing, rn, is_recipe)
end end
local function get_title_fs(query_item, favs, fs, spacing) local function get_title_fs(query_item, favs, fs, spacing)
local desc = ESC(get_desc(query_item))
desc = #desc > 33 and fmt("%s...", sub(desc, 1, 30)) or desc
local t_desc = query_item
t_desc = #t_desc > 35 and fmt("%s...", sub(t_desc, 1, 32)) or t_desc
fs[#fs + 1] = "style_type[label;font=bold;font_size=22]" fs[#fs + 1] = "style_type[label;font=bold;font_size=22]"
fs[#fs + 1] = fmt(FMT.label, 8.75, spacing - 0.1, desc) fs[#fs + 1] = fmt(FMT.label, 8.75, spacing - 0.1, nice_strip(ESC(get_desc(query_item)), 45))
fs[#fs + 1] = "style_type[label;font=mono;font_size=16]" fs[#fs + 1] = "style_type[label;font=mono;font_size=16]"
fs[#fs + 1] = fmt(FMT.label, 8.75, spacing + 0.3, clr("#7bf", t_desc)) fs[#fs + 1] = fmt(FMT.label, 8.75, spacing + 0.3, clr("#7bf", nice_strip(query_item, 35)))
fs[#fs + 1] = "style_type[label;font=normal;font_size=16]" fs[#fs + 1] = "style_type[label;font=normal;font_size=16]"
fs[#fs + 1] = fmt(FMT.hypertext, fs[#fs + 1] = fmt(FMT.hypertext,