chiark / gitweb /
script: Leave wresting mode on space
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 13 Jun 2022 00:11:40 +0000 (01:11 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 19 Jun 2022 09:24:16 +0000 (10:24 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
templates/script.ts

index ce6a395c4e4b2c942788cfa656e521ca3324aa00..dc279f2ea8280a4980a23b37efbc29a164a062f9 100644 (file)
@@ -397,7 +397,7 @@ function recompute_keybindings() {
     }
   }
   add_uo(null, {
-    def_key: 'W',
+    def_key: wresting ? 'W SPC' /* won't match, handle ad-hoc */ : 'W',
     kind: 'ClientExtra',
     opname: 'wrest',
     desc: wresting ? 'Exit wresting mode' : 'Enter wresting mode',
@@ -495,9 +495,10 @@ function some_keydown(e: KeyboardEvent) {
     mousecursor_etc_reupdate();
     return;
   }
-  if (e.key == ' ') {
+  if (e.key == ' ' || (e.key == 'W' && wresting)) {
     y();
     special_count = null;
+    wresting = false;
     mousecursor_etc_reupdate();
     return;
   }