From 59f64088e1e88f2f2a29e4d5418ccdf781fdc12e Mon Sep 17 00:00:00 2001 From: Guldoman Date: Wed, 24 Nov 2021 06:16:54 +0100 Subject: [PATCH] Remove changed files/dirs from `TreeView` cache --- data/core/init.lua | 2 +- data/plugins/treeview.lua | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/data/core/init.lua b/data/core/init.lua index 35609496..b0aef1af 100644 --- a/data/core/init.lua +++ b/data/core/init.lua @@ -1157,7 +1157,7 @@ end -- no-op but can be overrided by plugins -function core.on_dirmonitor_modify() +function core.on_dirmonitor_modify(dir, filepath) end diff --git a/data/plugins/treeview.lua b/data/plugins/treeview.lua index 659393ec..2e66083a 100644 --- a/data/plugins/treeview.lua +++ b/data/plugins/treeview.lua @@ -42,6 +42,14 @@ function TreeView:new() self.target_size = default_treeview_size self.cache = {} self.tooltip = { x = 0, y = 0, begin = 0, alpha = 0 } + + local on_dirmonitor_modify = core.on_dirmonitor_modify + function core.on_dirmonitor_modify(dir, filepath) + if self.cache[dir.name] then + self.cache[dir.name][filepath] = nil + end + on_dirmonitor_modify(dir, filepath) + end end