From f46b5b4b9c17067a34b8818c57d301efa4a669ba Mon Sep 17 00:00:00 2001 From: Adam Harrison Date: Tue, 23 Nov 2021 15:08:45 -0500 Subject: [PATCH] Fixed visible line stuff. --- data/core/docview.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/data/core/docview.lua b/data/core/docview.lua index cf64cdcd..6221553a 100644 --- a/data/core/docview.lua +++ b/data/core/docview.lua @@ -214,10 +214,9 @@ end function DocView:scroll_to_make_visible(line, col) local ox, oy = self:get_content_offset() - local _, min = self:get_line_screen_position(line - 1) - local _, max = self:get_line_screen_position(line + 2) - self.scroll.to.y = math.max(self.scroll.to.y, min - oy - self.size.y) - self.scroll.to.y = math.min(self.scroll.to.y, max - oy) + local _, ly = self:get_line_screen_position(line, col) + local lh = self:get_line_height() + self.scroll.to.y = common.clamp(self.scroll.to.y, ly - oy - self.size.y + lh * 2, ly - oy - lh) local gw = self:get_gutter_width() local xoffset = self:get_col_x_offset(line, col) local xmargin = 3 * self:get_font():get_width(' ')