Define horizontal scrollable size for `DocView`

This commit is contained in:
Guldoman 2021-08-23 05:40:50 +02:00 committed by Francesco
parent f1ca00fbed
commit c16145d562
1 changed files with 8 additions and 1 deletions

View File

@ -98,7 +98,14 @@ end
function DocView:get_scrollable_size()
return self:get_line_height() * (#self.doc.lines - 1) + self.size.y
local xmargin = 3 * self:get_font():get_width(' ') -- from DocView:scroll_to_make_visible
local long_line = 1
for l,_ in pairs(self.doc.long_lines.line_numbers) do -- get any of the longest lines
long_line = l
break
end
return self:get_line_height() * (#self.doc.lines - 1) + self.size.y,
self:get_col_x_offset(long_line, self.doc.long_lines.length) + self.size.x - xmargin
end