X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=rogue_chat_nocanvas_monochrome.html;h=d6e8a6ed3798cbf8165ba1333206de5646bec220;hb=4e31e852bd02aa77ce44f0ff8193ee6ca0552f58;hp=6093f9553994b4c73a747f04ee581c1697d434e6;hpb=4c164d8ac34965d2cc4e4e1f570c34789ec07fe1;p=plomrogue2 diff --git a/rogue_chat_nocanvas_monochrome.html b/rogue_chat_nocanvas_monochrome.html index 6093f95..d6e8a6e 100644 --- a/rogue_chat_nocanvas_monochrome.html +++ b/rogue_chat_nocanvas_monochrome.html @@ -4,8 +4,8 @@
-terminal rows: -terminal columns: +terminal rows: +terminal columns:

 
@@ -279,6 +279,7 @@ let server = {
         } else if (tokens[0] === 'UNHANDLED_INPUT') {
             tui.log_msg('? unknown command');
         } else if (tokens[0] === 'PLAY_ERROR') {
+            tui.log_msg('? ' + tokens[1]);
             terminal.blink_screen();
         } else if (tokens[0] === 'ARGUMENT_ERROR') {
             tui.log_msg('? syntax error: ' + tokens[1]);
@@ -379,6 +380,7 @@ let tui = {
     };
   },
   switch_mode: function(mode) {
+    this.inputEl.focus();
     this.show_help = false;
     this.map_mode = 'terrain';
     if (mode.shows_info && game.player_id in game.things) {
@@ -861,7 +863,6 @@ tui.inputEl.addEventListener('input', (event) => {
     }
     tui.full_refresh();
 }, false);
-
 tui.inputEl.addEventListener('keydown', (event) => {
     tui.show_help = false;
     if (event.key == 'Enter') {
@@ -967,7 +968,7 @@ tui.inputEl.addEventListener('keydown', (event) => {
 }, false);
 
 rows_selector.addEventListener('input', function() {
-    if (rows_selector.value % 4 != 0) {
+    if (rows_selector.value % 4 != 0 || rows_selector.value < 24) {
         return;
     }
     window.localStorage.setItem(rows_selector.id, rows_selector.value);
@@ -975,7 +976,7 @@ rows_selector.addEventListener('input', function() {
     tui.full_refresh();
 }, false);
 cols_selector.addEventListener('input', function() {
-    if (cols_selector.value % 4 != 0) {
+    if (cols_selector.value % 4 != 0 || cols_selector.value < 80) {
         return;
     }
     window.localStorage.setItem(cols_selector.id, cols_selector.value);
@@ -989,12 +990,6 @@ for (let key_selector of key_selectors) {
         tui.init_keys();
     }, false);
 }
-window.setInterval(function() {
-    if (!(['input', 'n_cols', 'n_rows'].includes(document.activeElement.id)
-          || document.activeElement.id.startsWith('key_'))) {
-        tui.inputEl.focus();
-    }
-}, 100);
 window.setInterval(function() {
     if (server.connected) {
         server.send(['PING']);
@@ -1003,7 +998,9 @@ window.setInterval(function() {
         tui.log_msg('@ attempting reconnect …')
     }
 }, 5000);
-
+document.getElementById("terminal").onclick = function() {
+    tui.inputEl.focus();
+};
 document.getElementById("help").onclick = function() {
     tui.show_help = true;
     tui.full_refresh();