home · contact · privacy
Add escape key "panic button" to return to play mode, whatever.
[plomrogue2] / rogue_chat.html
index c871b6a8f48eba02a27f7283c1922733211468b7..ebe64f2041fe4a4f755da1bea1a670185c23cdc2 100644 (file)
@@ -1472,11 +1472,12 @@ tui.inputEl.addEventListener('keydown', (event) => {
     if (event.key == 'Enter') {
         event.preventDefault();
     }
-    if (tui.mode.has_input_prompt && event.key == 'Enter'
-        && tui.inputEl.value.length == 0
-        && ['chat', 'command_thing', 'take_thing', 'drop_thing',
-            'admin_enter'].includes(tui.mode.name)) {
-        if (tui.mode.name != 'chat') {
+    if ((!tui.mode.is_intro && event.key == 'Escape')
+        || (tui.mode.has_input_prompt && event.key == 'Enter'
+            && tui.inputEl.value.length == 0
+            && ['chat', 'command_thing', 'take_thing', 'drop_thing',
+                'admin_enter'].includes(tui.mode.name))) {
+        if (!['chat', 'play', 'study', 'edit'].includes(tui.mode.name)) {
             tui.log_msg('@ aborted');
         }
         tui.switch_mode('play');