Commit aa037f38 authored by ThorbenQuast's avatar ThorbenQuast
Browse files

code editor: fix scrolling bug

parent ba2834a7
......@@ -19,7 +19,7 @@ var CodeEditorOutput = Emitter.extend({
'pdflatex %file': ['tex'],
'gcc %file -o %file.out && ./%file.out': ['c'],
'g++ %file -o %file.out && ./%file.out':
['cc','cp','cxx','cpp','CPP','c++','C']
['cc', 'cp', 'cxx', 'cpp', 'CPP', 'c++', 'C']
};
},
......@@ -75,23 +75,27 @@ var CodeEditorOutput = Emitter.extend({
self.updateExeButtons();
});
// register events
this.view.onSocket('start', function(data) {
self.wasAtBottom = self.isAtBottom();
self.append(
"executing \"" + data.command + "\"\n" +
"--------------------\n" +
"OUTPUT:\n\n");
if (wasAtBottom) self.goToBottom();
}).onSocket('data', function(data) {
self.append(data);
if (self.wasAtBottom) self.goToBottom();
}).onSocket('done', function(data) {
self.append(
"\n--------------------\n" +
(data.aborted ? "process was aborted!\n" : "") +
"runtime: " + self.formatRuntime(data.runtime) + "\n" +
"====================\n\n\n");
if (self.wasAtBottom) self.goToBottom();
self.running = false;
self.updateExeButtons();
self.goToBottom();
});
return this;
......@@ -104,7 +108,7 @@ var CodeEditorOutput = Emitter.extend({
if (fileExtension) {
fileExtension = fileExtension[1];
for (var i in this.commandlineTemplates) {
if ( ~this.commandlineTemplates[i].indexOf(fileExtension) ) {
if (~this.commandlineTemplates[i].indexOf(fileExtension)) {
this.commandline.val(i);
return true;
}
......@@ -219,10 +223,12 @@ var CodeEditorOutput = Emitter.extend({
append: function(text) {
this.initialClear();
var wasAtBottom = this.isAtBottom();
this.setText(this.getText() + String(text));
/*
var wasAtBottom = this.isAtBottom();
if (wasAtBottom)
this.goToBottom();
*/
return this;
},
......
Supports Markdown
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