From 916ab40d65c9c25f63256f2cd98be297c3da2208 Mon Sep 17 00:00:00 2001
From: Jakob Stendahl <jakob.stendahl@outlook.com>
Date: Thu, 28 Apr 2022 20:06:38 +0200
Subject: :bug: Small bugfixes

---
 src_frontend/Components/Editor/Output.svelte | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

(limited to 'src_frontend/Components/Editor/Output.svelte')

diff --git a/src_frontend/Components/Editor/Output.svelte b/src_frontend/Components/Editor/Output.svelte
index 9e4c953..52b7216 100644
--- a/src_frontend/Components/Editor/Output.svelte
+++ b/src_frontend/Components/Editor/Output.svelte
@@ -4,6 +4,7 @@
 
     let scrollBox;
     let htmlCode = "";
+    let buffer = "";
 
     function addData(data, classname) {
         // let styles = "white-space:pre-wrap;margin:0;";
@@ -17,11 +18,17 @@
                 styles += "color: red";
                 break;
         }
-        htmlCode += `<span style="${styles}">${data}</span>`;
+        buffer += `<span style="${styles}">${data}</span>`;
         if (scrollBox != null) {
             scrollBox.scrollTop = scrollBox.scrollHeight + 100;
         }
     }
+
+    function flushBuffer() {
+        htmlCode += buffer;
+        buffer = "";
+    };
+    setInterval(flushBuffer, 400);
     
     authorizedSocket.on("editor:proc:start", () => htmlCode = "");
     authorizedSocket.on("editor:proc:exit", (code) => addData(`\nMode exited with ${code}\n\n`, "exit"));
-- 
cgit v1.2.3

