simon-git: puzzles (main): Ben Harris
Commits to Tartarus hosted VCS
tartarus-commits at lists.tartarus.org
Tue Oct 25 00:16:23 BST 2022
TL;DR:
c1059c0 js: Remove braces from big else-if chain in keyboard handler
322a439 js: Use KeyboardEvent.keyCode and .char only as fallbacks
9698732 js: Add modern "key" values for Delete and arrow keys
0db5fb5 js: Remove the charCode argument from key()
768ef77 js: Use KeyboardEvent.key for ASCII keystrokes
f5ac13c js: Add mapping for UI_REDO based on KeyboardEvent.key
35d3820 js: Recognise KeyboardEvent.key == "Escape"
Repository: https://git.tartarus.org/simon/puzzles.git
On the web: https://git.tartarus.org/?p=simon/puzzles.git
Branch updated: main
Committer: Ben Harris <bjh21 at bjh21.me.uk>
Date: 2022-10-25 00:16:23
commit c1059c07fbb77f3f697b305aa55cdcd4361faf5c
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=c1059c07fbb77f3f697b305aa55cdcd4361faf5c;hp=a62217e9b42e81a66369f91600991944d148e0a9
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date: Mon Oct 24 21:57:53 2022 +0100
js: Remove braces from big else-if chain in keyboard handler
If there's ever a case where they're unnecessary noise, it's a long
chain of "else if"s guarding single assignment statements.
emcc.c | 33 ++++++++++++++++-----------------
1 file changed, 16 insertions(+), 17 deletions(-)
commit 322a439d801c91cf30a208cff499b33f4a5a2123
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=322a439d801c91cf30a208cff499b33f4a5a2123;hp=c1059c07fbb77f3f697b305aa55cdcd4361faf5c
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date: Mon Oct 24 22:07:12 2022 +0100
js: Use KeyboardEvent.keyCode and .char only as fallbacks
KeyboardEvent.keyCode is a platform-dependent mess.
KeyboardEvent.char is better-defined, but in my browser it's always
null. KeyboardEvent.key is the right thing to use when we want to
know the semantics of a key.
This commit just re-organises the big "else if" chain in key() so
that all the tests on "key" come first. That way at least if key and
keyCode disagree, we'll use the more trustworthy one.
emcc.c | 41 ++++++++++++++++++++++++++++++-----------
1 file changed, 30 insertions(+), 11 deletions(-)
commit 9698732d659451d5f5216834f7eea0eba46a623e
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=9698732d659451d5f5216834f7eea0eba46a623e;hp=322a439d801c91cf30a208cff499b33f4a5a2123
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date: Mon Oct 24 22:22:33 2022 +0100
js: Add modern "key" values for Delete and arrow keys
Firefox has emitted "Delete", "ArrowDown" etc since 2015.
emcc.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
commit 0db5fb525bb58056caf9303d2ac159fc51c04e04
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=0db5fb525bb58056caf9303d2ac159fc51c04e04;hp=9698732d659451d5f5216834f7eea0eba46a623e
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date: Mon Oct 24 22:37:30 2022 +0100
js: Remove the charCode argument from key()
It hasn't been used in a while.
emcc.c | 2 +-
emccpre.js | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
commit 768ef770a351ee1528e6e7923d3b3b00654401cb
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=768ef770a351ee1528e6e7923d3b3b00654401cb;hp=0db5fb525bb58056caf9303d2ac159fc51c04e04
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date: Mon Oct 24 23:06:12 2022 +0100
js: Use KeyboardEvent.key for ASCII keystrokes
This requires passing in KeyboardEvent.location from JavaScript so
that we can detect the numeric keypad properly. Out of caution we
currently only set MOD_NUM_KEYPAD on numbers, like we always have,
but we have enough information to set it on arrow keys, Enter, "+",
etc.
This finally gets '/' and '\' working in Slant again.
emcc.c | 14 +++++++++++++-
emccpre.js | 6 +++---
2 files changed, 16 insertions(+), 4 deletions(-)
commit f5ac13c847083a0499a258829be9c666cee7b00b
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=f5ac13c847083a0499a258829be9c666cee7b00b;hp=768ef770a351ee1528e6e7923d3b3b00654401cb
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date: Mon Oct 24 23:19:56 2022 +0100
js: Add mapping for UI_REDO based on KeyboardEvent.key
emcc.c | 2 ++
1 file changed, 2 insertions(+)
commit 35d382019fa3fead56cfe77b64e720acc1c0da09
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=35d382019fa3fead56cfe77b64e720acc1c0da09;hp=f5ac13c847083a0499a258829be9c666cee7b00b
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date: Mon Oct 24 23:33:09 2022 +0100
js: Recognise KeyboardEvent.key == "Escape"
emcc.c | 2 ++
1 file changed, 2 insertions(+)
More information about the tartarus-commits
mailing list