From 16911601f7da38191c5c1fe900d615f8b860ca52 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Tue, 13 Jan 2026 23:07:11 -0800 Subject: use explicit y-positioning for each line --- main.lua | 6 +++--- osd.lua | 17 ++++++++++++----- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/main.lua b/main.lua index 89e3586..5912ce7 100644 --- a/main.lua +++ b/main.lua @@ -565,7 +565,7 @@ local function open_epg_programme(prog, img_url) } if prog.desc then - options[#options+1] = {name = ' '} + options[#options+1] = {name = ''} for _, v in ipairs(util.wrap(prog.desc, 80)) do options[#options+1] = {name = v} end @@ -643,7 +643,7 @@ end local function add_info_set(options, set) if #set > 0 then - options[#options+1] = {name = ' '} + options[#options+1] = {name = ''} for _, v in ipairs(set) do options[#options+1] = v end @@ -664,7 +664,7 @@ local function open_option_title_info(title, info) local desc = util.strip_ne(info.description) or util.strip_ne(info.plot) if desc then - options[#options+1] = {name = ' '} + options[#options+1] = {name = ''} for _, v in ipairs(util.wrap(desc, 80)) do options[#options+1] = {name = v} end diff --git a/osd.lua b/osd.lua index d54362c..451f2a9 100644 --- a/osd.lua +++ b/osd.lua @@ -363,7 +363,7 @@ function mt:redraw(state) for i = 1, state.depth do out[#out+1] = self:menu_title(state.menus[i]) end - out[#out+1] = ' ' -- space character for correct line height + out[#out+1] = '' local menu = state:menu() @@ -404,14 +404,21 @@ function mt:redraw(state) out_max[#out_max+1] = self:option_icons(opt, info) .. str end + local buf = {} + -- each line uses a new ASS event with explicit positioning. otherwise, + -- lines with nonstandard height break things. -- \q2 disables line wrapping local pre = '{\\q2\\fs' .. config.font_size .. - '\\pos(' .. self.padding .. ',' .. self.padding .. ')}' - self.fg.data = pre .. table.concat(out, '\\N') + '\\pos(' .. self.padding .. ',%s)}' + for i, v in ipairs(out) do + local offset = self.padding + ((i - 1) * config.font_size) + buf[#buf+1] = pre:format(offset) .. v + end if img then - self.fg.data = self.fg.data .. '\n{\\alpha&HFF&}' .. - pre .. table.concat(out_max, '\\N') + buf[#buf+1] = '{\\alpha&HFF&}' .. pre:format(0) .. + table.concat(out_max, '\\N') end + self.fg.data = table.concat(buf, '\n') self.bg.data = '{\\pos(0,0)\\alpha&H' .. config.bg_alpha .. '&\\c&H&}' .. -- cgit v1.2.3-70-g09d2