diff options
author | Elliott Hughes <enh@google.com> | 2019-03-23 12:32:40 -0700 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2019-04-11 17:04:21 -0500 |
commit | e478b177ab79aab7b5dfa52e5a0853e144a62327 (patch) | |
tree | 5d5cadcda868ece523c205aff61c8ef1aa4443d1 /toys/android/setprop.c | |
parent | 1a0ec19591a104b1d14b4a7ecae47740997953a4 (diff) | |
download | toybox-e478b177ab79aab7b5dfa52e5a0853e144a62327.tar.gz |
scan_key: support more terminals.
Although we can get away with ignoring termcap/terminfo on the output
side by restricting ourselves to generally-supported escape sequences,
the input side is trickier because we need to support the sequences sent
by common terminals. Luckily, this isn't is as bad as it sounds because
only Home/End commonly differ. But it does mean we need a slightly
different implementation to deal with the many-to-one mapping.
Since we can't use TAGGED_ARRAY for this (without inflicting pain on all
the callers) I've also switched to OR-ing in the modifier keys, so we
have (say) KEY_UP|KEY_SHIFT rather than a separate KEY_SUP. This also
generalizes better should we ever need to support multiple modifiers at
once.
To reduce the number of #defines, I've also switched from KEY_F1,
KEY_F2, and so on to KEY_FN+1, KEY_FN+2, and so on. This isn't obviously
necessary, and easily undone if we'd rather have move #defines in return
for slightly more natural naming.
To enable all this, I've inverted scan_key and scan_key_getsize so that
scan_key_getsize is now the underlying function, and we don't waste all
the top bits encoding width and height between scan_key and
scan_key_getsize.
Tested by pressing Home and End in hexedit in all of the terminals
available to me.
Diffstat (limited to 'toys/android/setprop.c')
0 files changed, 0 insertions, 0 deletions