On 8 December 2015 at 15:19, Gavin Smith <[email protected]> wrote: > On 28 November 2015 at 18:47, Robert Ross <[email protected]> wrote: >> Is there still a way to map keys such as "F1" and "Ctrl-Down" in version >> 6.0? For xterm and mintty in version 5.2, the following worked: >> >> \eOP get-help-window # <F1> >> \e[1;5B down-line # <C-Down> >> >> Setting "key-time" to "0" did not help. The ability to specify a "keyseq", >> as in "readline", would restore flexibility.
So what I'm thinking about is if 3 or more bytes are read at once, and key-time is 0, then they are viewed as individual keys being pressed. For example ESC O P could be viewed as three keys, or two (M-O P). Because of the many key bindings for meta, two bytes should carry on being composed into keys, for example ESC f converted into M-f. Likewise for ESC on its own, meaning that ESC was pressed. This works for a terminal emulator which likely results in multiple bytes being written at once to and from the kernel's buffers. For network connections, this may not work. Sometimes the ESC would come in first, which would be fine, or if ESC O P came in together. If ESC O came in together first, it wouldn't be recognized, unless you also had a key binding for "\mOP". That's a possible problem but a minor one. The downside is that unknown key sequences can produce garbage results. For example, for me when I set key-time to 0 and press F5 after running "info", I'm dumped in "(automake.info)aclocal Invocation" with an error message "Unknown command (~)." That's a confusing experience, but it isn't so bad because key-time = 0 isn't the default. This is an almost consistent interpretation of the key-time variable. If three bytes come in at times b1, b2 and b3 (in that order), with b1 = b2 = b3, and key-time is k = 0, then b2 - b1 < k, b3 - b2 < k so they should be separated. If two bytes come in at the same time b1 = b2, then b2 - b1 <= k, so they should be combined. If you don't like that (because of the inconsistency between < and <=) pretend that there's are tiny delays between the bytes of unpredictable lengths meaning sometimes the bytes will be combined and sometimes they won't be.
