From 182a2bce7d159f8ba98084ffd8cfafeaab9097aa Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Mon, 29 May 2023 22:10:25 +0200 Subject: [PATCH] fixed termial newline handle --- src/bin/Terminal.hx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/bin/Terminal.hx b/src/bin/Terminal.hx index e802018..0a49471 100644 --- a/src/bin/Terminal.hx +++ b/src/bin/Terminal.hx @@ -117,11 +117,24 @@ class Terminal implements Process { ProcessManager.run(ps,{ args: commandArgs, onWrite: (s:String) -> { + if (s == "") { + 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; } - this.backlog[this.backlog.length - 1] += s; + + for (line in s.split("\n")) { + if (line == ""){ + this.backlog.push(""); + } else { + this.backlog[this.backlog.length - 1] += s; + } + } + this.requestRender(); }, onExit: (success:Bool) -> {