From b918f248cb83dc25800ae5b62591f9537a80a5d7 Mon Sep 17 00:00:00 2001 From: Guldoman Date: Tue, 7 Dec 2021 21:45:20 +0100 Subject: [PATCH] Avoid drawing hidden `TreeView` items --- data/plugins/treeview.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/data/plugins/treeview.lua b/data/plugins/treeview.lua index 18d622e1..8edee393 100644 --- a/data/plugins/treeview.lua +++ b/data/plugins/treeview.lua @@ -366,15 +366,18 @@ end function TreeView:draw() self:draw_background(style.background2) + local _y, _h = self.position.y, self.size.y local doc = core.active_view.doc local active_filename = doc and system.absolute_path(doc.filename or "") for item, x,y,w,h in self:each_item() do - self:draw_item(item, - item.abs_filename == active_filename, - item == self.hovered_item, - x, y, w, h) + if y + h >= _y and y < _y + _h then + self:draw_item(item, + item.abs_filename == active_filename, + item == self.hovered_item, + x, y, w, h) + end end self:draw_scrollbar()