diff options
| author | Jefferson González <jgmdev@gmail.com> | 2024-06-23 01:55:02 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-23 01:55:02 -0400 |
| commit | a86c813a2ef9500cd07e27642914ef719e217090 (patch) | |
| tree | b34e2c997c22e57bf06e6cba90e849c18c334bcb /data/plugins | |
| parent | b94b4b3698300366bd9fc911a98f1193936b431d (diff) | |
| download | pragtical-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.lua | 6 |
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 |
