chiark / gitweb /
script: Allow backspace to delete typed special count
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 13 Jun 2022 00:44:33 +0000 (01:44 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 19 Jun 2022 09:23:24 +0000 (10:23 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
templates/script.ts

index 2d2cb56f1946d35028d8488ab253503b0a8f0d20..09994c2f491f322d603d28983621b03eb09fc269 100644 (file)
@@ -500,6 +500,17 @@ function some_keydown(e: KeyboardEvent) {
     mousecursor_etc_reupdate();
     return;
   }
+  if (e.key == 'Backspace') {
+    if (special_count == null) {
+      wresting = false;
+    } else if (special_count >= 10) {
+      special_count = Math.round(special_count / 10 - .45);
+    } else {
+      special_count = null;
+    }
+    mousecursor_etc_reupdate();
+    return;
+  }
 
   let uo = uo_map[e.key];
   if (uo === undefined || uo === null) return;