aboutsummaryrefslogtreecommitdiff
path: root/data/plugins
diff options
context:
space:
mode:
authorJefferson González <jgmdev@gmail.com>2024-06-23 01:55:02 -0400
committerGitHub <noreply@github.com>2024-06-23 01:55:02 -0400
commita86c813a2ef9500cd07e27642914ef719e217090 (patch)
treeb34e2c997c22e57bf06e6cba90e849c18c334bcb /data/plugins
parentb94b4b3698300366bd9fc911a98f1193936b431d (diff)
downloadpragtical-a86c813a2ef9500cd07e27642914ef719e217090.tar.gz
pragtical-a86c813a2ef9500cd07e27642914ef719e217090.zip
Check doc is still in view before autoreloading it (#104)
Diffstat (limited to 'data/plugins')
-rw-r--r--data/plugins/autoreload.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/data/plugins/autoreload.lua b/data/plugins/autoreload.lua
index b1e0e138..b86f2b48 100644
--- a/data/plugins/autoreload.lua
+++ b/data/plugins/autoreload.lua
@@ -72,8 +72,12 @@ local core_set_active_view = core.set_active_view
function core.set_active_view(view)
core_set_active_view(view)
if core.active_view.doc and changed[core.active_view.doc] then
+ local doc = core.active_view.doc
core.add_thread(function()
- autoreload_doc(core.active_view.doc)
+ -- validate doc in case the active view rapidly changed
+ if doc == core.active_view.doc then
+ autoreload_doc(doc)
+ end
end)
end
end