fixed line printing in Terminal
This commit is contained in:
parent
e5b990ae61
commit
1108eab403
@ -62,6 +62,8 @@ class Terminal implements IProcess {
|
|||||||
if (this.runningPID > 0)
|
if (this.runningPID > 0)
|
||||||
return;
|
return;
|
||||||
this.backlog.push("> " + this.input);
|
this.backlog.push("> " + this.input);
|
||||||
|
this.backlog.push("");
|
||||||
|
|
||||||
var command = this.input;
|
var command = this.input;
|
||||||
this.input = "";
|
this.input = "";
|
||||||
this.scrollBack = 0;
|
this.scrollBack = 0;
|
||||||
@ -91,6 +93,8 @@ class Terminal implements IProcess {
|
|||||||
var arg1 = handle.args[0];
|
var arg1 = handle.args[0];
|
||||||
|
|
||||||
this.backlog.push("> " + arg1);
|
this.backlog.push("> " + arg1);
|
||||||
|
this.backlog.push("");
|
||||||
|
|
||||||
EndOfLoop.endOfLoop(() -> {
|
EndOfLoop.endOfLoop(() -> {
|
||||||
this.invokeCommand(arg1);
|
this.invokeCommand(arg1);
|
||||||
});
|
});
|
||||||
@ -177,24 +181,13 @@ class Terminal implements IProcess {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var mfunc = NativeStringTools.gmatch(s, "(.-)(\n)");
|
var splits = s.split("\n");
|
||||||
|
|
||||||
while (true) {
|
for (i => split in splits) {
|
||||||
var found = mfunc();
|
if (i == 0) {
|
||||||
|
this.backlog[this.backlog.length - 1] += split;
|
||||||
if (found == null) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (found == "\n") {
|
|
||||||
this.backlog.push("");
|
|
||||||
} else {
|
} else {
|
||||||
this.backlog.push(found);
|
this.backlog.push(split);
|
||||||
}
|
|
||||||
|
|
||||||
// Trim the backlog if it's too long
|
|
||||||
if (this.backlog.length > MAX_BACKLOG) {
|
|
||||||
this.backlog.shift();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user