diff --git a/app/renderer/abr-document.js b/app/renderer/abr-document.js index ca38b9a..1fe838d 100644 --- a/app/renderer/abr-document.js +++ b/app/renderer/abr-document.js @@ -390,6 +390,8 @@ AbrDocument.prototype = { that.startWatcher(); }); } else { + // The previous document is dropped from the editor. + // The watcher will resume on save. that.setDirty(); that.updateWindowTitle(); } @@ -399,8 +401,8 @@ AbrDocument.prototype = { if (keepFile) { that.setDirty(); that.updateWindowTitle(); + that.startWatcher(); } else { - that.pauseWatcher(); that.clear(); } }); @@ -408,10 +410,13 @@ AbrDocument.prototype = { }; this.watcher = files.createWatcher(this.path, { change: function (path) { + // Pause the watcher to avoid triggering multiple warning dialogs + // while the first one is being handled. that.pauseWatcher(); runOnFocus(handleAsyncFileChange, path); }, unlink: function (path) { + that.pauseWatcher(); runOnFocus(handleAsyncFileChange, path); }, error: function (err) {