fixed termial newline handle

This commit is contained in:
Djeeberjr 2023-05-29 22:10:25 +02:00
parent 05a220110d
commit 182a2bce7d

View File

@ -117,11 +117,24 @@ class Terminal implements Process {
ProcessManager.run(ps,{ ProcessManager.run(ps,{
args: commandArgs, args: commandArgs,
onWrite: (s:String) -> { onWrite: (s:String) -> {
if (s == "") {
return;
}
if (!hadInput) { if (!hadInput) {
// Add a new line, so that the input is not on the same line as the command
this.backlog.push(""); this.backlog.push("");
hadInput = true; hadInput = true;
} }
for (line in s.split("\n")) {
if (line == ""){
this.backlog.push("");
} else {
this.backlog[this.backlog.length - 1] += s; this.backlog[this.backlog.length - 1] += s;
}
}
this.requestRender(); this.requestRender();
}, },
onExit: (success:Bool) -> { onExit: (success:Bool) -> {