Commit c5a35c64 authored by Benjamin Fischer's avatar Benjamin Fischer
Browse files

Fixing saving in codeeditor & fix selfcleanup of watches. fix #1921

parent defc4892
......@@ -9,6 +9,7 @@ var CodeEditor = Emitter.extend({
this.mtime = null;
this.lastContent = "";
this.modified_processing = false;
this.saving_processing = false;
this.ace = null;
this.originalAceCommands = null;
......@@ -61,7 +62,7 @@ var CodeEditor = Emitter.extend({
}
self.modified_processing = false;
});
} else if (data.mtime != self.mtime) {
} else if (data.mtime != self.mtime && !self.saving_processing) {
self.modified_processing = true;
self.view.confirm(
"The file " + self.path + " has changed on disk." +
......@@ -272,6 +273,7 @@ var CodeEditor = Emitter.extend({
}
this.view.setLoading(true);
this.saving_processing = true;
this.view.POST(vispa.url.dynamic("/ajax/fs/save_file"), {
path: this.path,
......@@ -287,6 +289,7 @@ var CodeEditor = Emitter.extend({
callback();
}).always(function() {
self.view.setLoading(false);
self.saving_processing = false;
});
return this;
......
......@@ -511,12 +511,13 @@ class FileSystem(object):
if event.action_name == 'access':
return
if os.path.exists(event.watch.path):
mtime = os.path.getmtime(event.watch.path)
else:
mtime = -1
with self._monitor_lock:
# inform all listener
if os.path.exists(event.watch.path):
mtime = os.path.getmtime(event.watch.path)
else:
mtime = -1
for combined_id in event.watch.listener:
vispa.remote.send_topic(
"extension.%s.socket.watch" % combined_id[1],
......@@ -529,7 +530,7 @@ class FileSystem(object):
})
# cleanup yourself
if mtime == -1:
if event.action_name in ['delete self','move self']:
for combined_id in event.watch.listener:
del self._monitor_listener[combined_id]
event.watch.listener = []
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment