diff options
Diffstat (limited to 'osd.lua')
| -rw-r--r-- | osd.lua | 27 |
1 files changed, 15 insertions, 12 deletions
@@ -61,12 +61,8 @@ function mt:resize(w, h) end function mt:menu_lines(state) - if state.depth > 1 then - -- leaves an extra line for padding between titles and options - return self.lines - state.depth - else - return self.lines - end + -- leaves an extra line for padding between titles and options + return self.lines - state.depth - 1 end function mt:menu_title(menu) @@ -94,7 +90,7 @@ function mt:menu_title(menu) str = colours.icon_sorted .. '⇅ ' .. col .. str end - return col .. ' » ' .. str + return col .. '» ' .. str end function mt:option_icons(opt, info) @@ -364,12 +360,10 @@ function mt:redraw(state) -- navigation which moves the viewport. local out_max = {} - if state.depth > 1 then - for i = 2, state.depth do - out[#out+1] = self:menu_title(state.menus[i]) - end - out[#out+1] = ' ' -- space character for correct line height + 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 local menu = state:menu() @@ -469,4 +463,13 @@ function mt:is_hidden() return self.fg.hidden end +function mt:get_mouse_line(mpos) + local y = mpos.y / self.scale + local line = math.floor((y - self.padding) / config.font_size) + 1 + if line < 1 or line > self.lines then + return + end + return line +end + return osd |
