Commit 257094fc authored by ThorbenQuast's avatar ThorbenQuast
Browse files

minor commandline bugfix: default (file type dependent) command shown & stored if a

new file is created and no previous command has been saved yet
parent f3873fa7
......@@ -33,19 +33,19 @@ var CommandLine = Emitter.extend({
trigger: "focus"
});
this.histNode = rightTopNode.find(".dropdown-menu");
this.setCommandLine();
this.pushDefault(this.getVal());
this.setDefault();
},
setCommandLine: function() {
setDefault: function() {
if (this.view.editor && this.view.editor.path) {
var fileExtension = this.view.editor.path.match(/\.(.+?)$/);
if (fileExtension) {
fileExtension = fileExtension[1];
for (var i in this.commandlineTemplates) {
if (~this.commandlineTemplates[i].indexOf(fileExtension)) {
this.commandline.val(i);
if (this.commands.length === 0)
this.commandline.val(i);
this.pushDefault(i);
return true;
}
}
......@@ -95,7 +95,8 @@ var CommandLine = Emitter.extend({
self.histNode.append(self.createNode(entry.name, entry.cmd));
});
this.histNode.append($("<li/>").addClass("divider"));
this.histNode.append(self.createNode("default", this.defaultCommand.cmd));
if (this.defaultCommand !== null)
this.histNode.append(self.createNode("default", this.defaultCommand.cmd));
},
createNode: function(name, cmd) {
......
......@@ -294,7 +294,6 @@ var CodeEditor = Emitter.extend({
}
});
} else {
self.view.commandLine.setCommandLine();
self.save(callback, "new", path);
}
},
......@@ -347,6 +346,7 @@ var CodeEditor = Emitter.extend({
self.lastContent = self.getContent();
self.checkModifications();
self.setMode();
self.view.commandLine.setDefault();
self.view.preview.setPath(self.path, true);
if ($.isFunction(callback))
callback();
......
......@@ -111,16 +111,17 @@ var CodeEditorOutput = Emitter.extend({
return this;
}
var cmd = self.view.commandLine.getVal();
if (!cmd) {
this.view.alert("Please indicate a valid command for script execution!");
return this;
}
this.view.commandLine.pushEntry(cmd);
this.view.editor.save(function() {
// create the command
var cmd = self.view.commandLine.getVal();
//store the command
self.view.commandLine.pushEntry(cmd);
if (!cmd) {
self.view.alert("Please indicate a valid command for script execution!");
return this;
}
if (self.running) {
self.view.alert("There is already a running job!");
return this;
......
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