diff options
author | Rohan Vashisht <81112205+RohanVashisht1234@users.noreply.github.com> | 2024-04-07 02:49:53 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-06 23:19:53 +0200 |
commit | a0c417b3e9b7a0fa8e1525f3535c2f8f758e3faf (patch) | |
tree | 51a9198977137be56c9edf1eb5403ebcd75ba471 | |
parent | 249f17e6f5f364a7d8f933cb31fd82124f93909c (diff) | |
download | lite-xl-plugins-a0c417b3e9b7a0fa8e1525f3535c2f8f758e3faf.tar.gz lite-xl-plugins-a0c417b3e9b7a0fa8e1525f3535c2f8f758e3faf.zip |
Don't run `autosaveonfocuslost.lua` on user and project modules (#411)
* Update autosaveonfocuslost.lua
* Update manifest.json
* Update autosaveonfocuslost.lua
* Update autosaveonfocuslost.lua
* Update autosaveonfocuslost.lua
* Update autosaveonfocuslost.lua
-rw-r--r-- | manifest.json | 2 | ||||
-rw-r--r-- | plugins/autosaveonfocuslost.lua | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/manifest.json b/manifest.json index 8394393..2c1a770 100644 --- a/manifest.json +++ b/manifest.json @@ -187,7 +187,7 @@ "id": "autosaveonfocuslost", "mod_version": "3", "path": "plugins/autosaveonfocuslost.lua", - "version": "0.1" + "version": "0.2" }, { "description": "Automatically hardwraps lines when typing", diff --git a/plugins/autosaveonfocuslost.lua b/plugins/autosaveonfocuslost.lua index 1a9bd0c..5dd8bce 100644 --- a/plugins/autosaveonfocuslost.lua +++ b/plugins/autosaveonfocuslost.lua @@ -11,8 +11,10 @@ local function save_node(node) local i = 1 while i <= #node.views do local view = node.views[i] - if view:is(DocView) and not view:is(CommandView) and - view.doc.filename and view.doc:is_dirty() then + if view:is(DocView) and not view:is(CommandView) + and view.doc.abs_filename ~= system.absolute_path(USERDIR .. PATHSEP .. "init.lua") + and view.doc.abs_filename ~= system.absolute_path(".lite_project.lua") + and view.doc.filename and view.doc:is_dirty() then core.log("Saving doc \"%s\"", view.doc.filename) view.doc:save() end |