Fixed visible line stuff.

This commit is contained in:
Adam Harrison 2021-11-23 15:08:45 -05:00
parent 023aaa4793
commit f46b5b4b9c
1 changed files with 3 additions and 4 deletions

View File

@ -214,10 +214,9 @@ end
function DocView:scroll_to_make_visible(line, col) function DocView:scroll_to_make_visible(line, col)
local ox, oy = self:get_content_offset() local ox, oy = self:get_content_offset()
local _, min = self:get_line_screen_position(line - 1) local _, ly = self:get_line_screen_position(line, col)
local _, max = self:get_line_screen_position(line + 2) local lh = self:get_line_height()
self.scroll.to.y = math.max(self.scroll.to.y, min - oy - self.size.y) self.scroll.to.y = common.clamp(self.scroll.to.y, ly - oy - self.size.y + lh * 2, ly - oy - lh)
self.scroll.to.y = math.min(self.scroll.to.y, max - oy)
local gw = self:get_gutter_width() local gw = self:get_gutter_width()
local xoffset = self:get_col_x_offset(line, col) local xoffset = self:get_col_x_offset(line, col)
local xmargin = 3 * self:get_font():get_width(' ') local xmargin = 3 * self:get_font():get_width(' ')