docview: prevent overscroll when DocView size is less than lh * 2 (#1971)
This commit is contained in:
@@ -259,7 +259,8 @@ function DocView:scroll_to_make_visible(line, col)
|
||||
local _, ly = self:get_line_screen_position(line, col)
|
||||
local lh = self:get_line_height()
|
||||
local _, _, _, scroll_h = self.h_scrollbar:get_track_rect()
|
||||
self.scroll.to.y = common.clamp(self.scroll.to.y, ly - oy - self.size.y + scroll_h + lh * 2, ly - oy - lh)
|
||||
local overscroll = math.min(lh * 2, self.size.y) -- always show the previous / next line when possible
|
||||
self.scroll.to.y = common.clamp(self.scroll.to.y, ly - oy - self.size.y + scroll_h + overscroll, 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(' ')
|
||||
|
||||
Reference in New Issue
Block a user