Correct Node's clipping rectangle

Fixing the Node's clipping rectangle make the clipping in DocView:draw()
partially redundant. This latter is now no longer needed to clip
on the right when drawing the document's lines but it still serves to
the purpose of clipping on the left, before the gutter region.
This commit is contained in:
Francesco Abbate 2021-10-11 09:25:38 +02:00
parent 8b634daa66
commit 0d2166c9ce
2 changed files with 3 additions and 1 deletions

View File

@ -439,6 +439,8 @@ function DocView:draw()
local pos = self.position
x, y = self:get_line_screen_position(minline)
-- the clip below ensure we don't write on the gutter region. On the
-- right side it is redundant with the Node's clip.
core.push_clip_rect(pos.x + gw, pos.y, self.size.x - gw, self.size.y)
for i = minline, maxline do
self:draw_line_body(i, x, y)

View File

@ -595,7 +595,7 @@ function Node:draw()
self:draw_tabs()
end
local pos, size = self.active_view.position, self.active_view.size
core.push_clip_rect(pos.x, pos.y, pos.x + size.x, pos.y + size.y)
core.push_clip_rect(pos.x, pos.y, size.x, size.y)
self.active_view:draw()
core.pop_clip_rect()
else