From 76a68a75f19ba7fe8b66d210f979fbd3c0c97eaa Mon Sep 17 00:00:00 2001 From: minie4 Date: Tue, 27 Apr 2021 15:25:29 +0200 Subject: [PATCH] Properly set the tty cols and rows --- index.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 9ed8083..eb71e7e 100644 --- a/index.js +++ b/index.js @@ -110,11 +110,19 @@ function onConsoleLine(line) { previous_line = line; } -// Fit xterm to the container on window resize +// Resize the terminal window.addEventListener("resize", () => { - termfit.fit() + resize(); }) +function resize() { + // Resize the terminal + termfit.fit(); + + // Send tty resize over /dev/console so that the user can't see it + emulator.keyboard_send_text(`stty cols ${term.cols} rows ${term.rows} -F /dev/ttyS0\n`) +} + function debug(text) { console.debug("DEBUG: "+text) } \ No newline at end of file