From 2abd87460be7d85ed9a75c54d26e421ecdb6210d Mon Sep 17 00:00:00 2001 From: Steffen Zschaler Date: Wed, 29 Nov 2023 17:11:49 +0000 Subject: [PATCH] Make console always scroll to bottom on updates. --- platform/src/ConsolePanel.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/platform/src/ConsolePanel.js b/platform/src/ConsolePanel.js index 13e82e0..4709897 100644 --- a/platform/src/ConsolePanel.js +++ b/platform/src/ConsolePanel.js @@ -24,11 +24,17 @@ class ConsolePanel extends Panel { this.setTitleAndIcon("Console", "console"); } + setValue(value) { + this.setOutput(value+""); + } + setOutput(str) { - document.getElementById(this.id + "Editor").style.color = "black"; + let element = document.getElementById(this.id + "Editor"); + element.style.color = "black"; this.editor.getSession().setUseWrapMode(false); this.editor.setValue(str, 1); - + // Scroll to the bottom. This works because we're really still using an ACE editor even in the console panel. + this.editor.renderer.scrollToLine(Number.POSITIVE_INFINITY); } setError(str) {