fixes terminal newline handling
This commit is contained in:
parent
12eb9d05de
commit
e0d4844890
@ -1,5 +1,6 @@
|
||||
package bin;
|
||||
|
||||
import lua.NativeStringTools;
|
||||
import kernel.binstore.BinStore;
|
||||
import kernel.ps.ProcessHandle;
|
||||
import kernel.ps.Process;
|
||||
@ -139,7 +140,6 @@ class Terminal implements Process {
|
||||
}
|
||||
|
||||
var commandArgs:Array<String> = args.slice(1);
|
||||
var hadInput = false;
|
||||
|
||||
var ps = getProgByName(commandName);
|
||||
if (ps == null) {
|
||||
@ -155,17 +155,19 @@ class Terminal implements Process {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!hadInput) {
|
||||
// Add a new line, so that the input is not on the same line as the command
|
||||
this.backlog.push("");
|
||||
hadInput = true;
|
||||
}
|
||||
var mfunc = NativeStringTools.gmatch(s, "(.-)(\n)");
|
||||
|
||||
for (line in s.split("\n")) {
|
||||
if (line == "") {
|
||||
while (true) {
|
||||
var found = mfunc();
|
||||
|
||||
if (found == null) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (found == "\n") {
|
||||
this.backlog.push("");
|
||||
} else {
|
||||
this.backlog[this.backlog.length - 1] += s;
|
||||
this.backlog.push(found);
|
||||
}
|
||||
|
||||
// Trim the backlog if it's too long
|
||||
|
Loading…
Reference in New Issue
Block a user