diff options
| author | Alon Zakai <alonzakai@gmail.com> | 2012-03-23 16:38:08 -0700 |
|---|---|---|
| committer | Alon Zakai <alonzakai@gmail.com> | 2012-03-23 16:38:08 -0700 |
| commit | 6b2a2b6c8a3f416660be36a846a45cf635af2a5d (patch) | |
| tree | 39e900744ed7c2d34b90fb3e2a3b245425d0e735 /src/shell.html | |
| parent | 6a3c3938cd802db8b034c27b743844735f1b6d28 (diff) | |
fix sdl keyboard input and add a test
Diffstat (limited to 'src/shell.html')
| -rw-r--r-- | src/shell.html | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/shell.html b/src/shell.html index 2f83f9f9..79b7e9b9 100644 --- a/src/shell.html +++ b/src/shell.html @@ -15,12 +15,15 @@ var Module = { print: (function() { var element = document.getElementById('output'); + var printBuffer = []; return function(text) { text = text.replace(/&/g, "&"); text = text.replace(/</g, "<"); text = text.replace(/>/g, ">"); text = text.replace('\n', '<br>', 'g'); - element.innerHTML += text + '<br>'; + if (printBuffer.length > 10) printBuffer.shift(); + printBuffer.push(text); + element.innerHTML = printBuffer.join('<br>'); }; })(), canvas: document.getElementById('canvas'), |
