diff --git a/src/bin/Terminal.hx b/src/bin/Terminal.hx index d16be44..298e392 100644 --- a/src/bin/Terminal.hx +++ b/src/bin/Terminal.hx @@ -62,6 +62,8 @@ class Terminal implements IProcess { if (this.runningPID > 0) return; this.backlog.push("> " + this.input); + this.backlog.push(""); + var command = this.input; this.input = ""; this.scrollBack = 0; @@ -91,6 +93,8 @@ class Terminal implements IProcess { var arg1 = handle.args[0]; this.backlog.push("> " + arg1); + this.backlog.push(""); + EndOfLoop.endOfLoop(() -> { this.invokeCommand(arg1); }); @@ -177,24 +181,13 @@ class Terminal implements IProcess { return; } - var mfunc = NativeStringTools.gmatch(s, "(.-)(\n)"); + var splits = s.split("\n"); - while (true) { - var found = mfunc(); - - if (found == null) { - break; - } - - if (found == "\n") { - this.backlog.push(""); + for (i => split in splits) { + if (i == 0) { + this.backlog[this.backlog.length - 1] += split; } else { - this.backlog.push(found); - } - - // Trim the backlog if it's too long - if (this.backlog.length > MAX_BACKLOG) { - this.backlog.shift(); + this.backlog.push(split); } }