From 0d2166c9cee35b8381a3467be2fb52a1e0d918fb Mon Sep 17 00:00:00 2001 From: Francesco Abbate Date: Mon, 11 Oct 2021 09:25:38 +0200 Subject: [PATCH] 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. --- data/core/docview.lua | 2 ++ data/core/rootview.lua | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/data/core/docview.lua b/data/core/docview.lua index 7dbfbccf..a73bfc9c 100644 --- a/data/core/docview.lua +++ b/data/core/docview.lua @@ -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) diff --git a/data/core/rootview.lua b/data/core/rootview.lua index 3c4feda0..f5b1e534 100644 --- a/data/core/rootview.lua +++ b/data/core/rootview.lua @@ -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