From: Ian Jackson Date: Mon, 13 Jun 2022 00:44:33 +0000 (+0100) Subject: script: Allow backspace to delete typed special count X-Git-Tag: otter-1.2.0~22 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=4a086e4b9ab7b4dfc1f9af7d465214a449438ef4;p=otter.git script: Allow backspace to delete typed special count Signed-off-by: Ian Jackson --- diff --git a/templates/script.ts b/templates/script.ts index 2d2cb56f..09994c2f 100644 --- a/templates/script.ts +++ b/templates/script.ts @@ -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;