From b479df01406e22242a399cda1e945c69feb71ee9 Mon Sep 17 00:00:00 2001 From: Brad Nelson Date: Mon, 8 Aug 2022 00:05:48 -0700 Subject: [PATCH] Fix mobile bug with lines. --- web/platform.fs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/web/platform.fs b/web/platform.fs index 7f1a18e..bf5a262 100644 --- a/web/platform.fs +++ b/web/platform.fs @@ -77,15 +77,18 @@ if (!globalObj.write) { context.last_line = line; }; - context.ResetTerminal = function() { - if (context.terminal) { - context.screen.removeChild(context.terminal); - } - context.terminal = document.createElement('div'); - context.terminal.style.width = '100%'; - context.terminal.style.whiteSpace = 'pre-wrap'; - context.screen.appendChild(context.terminal); + context.terminal = document.createElement('div'); + context.terminal.style.width = '100%'; + context.terminal.style.whiteSpace = 'pre-wrap'; + context.screen.appendChild(context.terminal); + context.lines = []; + context.last_line = null; + context.outbuffer = []; + context.ResetTerminal = function() { + for (var i = 0; i < context.lines.length; ++i) { + context.terminal.removeChild(context.lines[i]); + } context.lines = []; context.last_line = null; context.outbuffer = [];