Fixed character detection in playground.
h3rald h3rald@h3rald.com
Mon, 02 Dec 2024 05:41:21 +0000
1 files changed,
5 insertions(+),
1 deletions(-)
jump to
M
web/assets/hex-playground.js
→
web/assets/hex-playground.js
@@ -8,6 +8,10 @@ Module.print = (text) => {
document.querySelector("article section").textContent += text + '\n'; }; +Module.printErr = (text) => { + document.querySelector("article section").textContent += text + '\n'; +}; + const inputBox = document.querySelector("article input"); inputBox.addEventListener("keydown", (e) => {@@ -16,7 +20,7 @@ e.preventDefault();
Module.pending_lines.push(Module.pending_chars.join('')); Module.pending_chars = []; inputBox.value = ''; - } else { + } else if (e.key.length === 1) { Module.pending_chars.push(e.key); } if (Module.pending_fgets.length > 0 && Module.pending_lines.length > 0) {