]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
i9e: Avoid key binding macros.
authorAndre Noll <maan@tuebingen.mpg.de>
Sat, 3 Oct 2015 17:51:38 +0000 (17:51 +0000)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 25 Oct 2015 15:13:43 +0000 (16:13 +0100)
The key binding code of interactive.c is quite an ugly hack which is
marked with a FIXME comment since forever. We bind each key sequence
given in the ->bound_keyseqs array of struct i9e_client_info to a
key code which is then mapped to a command handler provoded by the
application. The bindings started at key 64 with an arbitrary limit
of 32 possible mappings.

Besides being ugly, the problem with this mapping scheme is that
upper case keys are also in this range and are hence also mapped to
the specified commands.

This commit takes another approach. We now bind key sequences to a
function instead of a macro, passing ISFUNC as the first parameter to
libreadline's rl_generic_bind(). All key sequences are bound to the
same function, dispatch_key(), which calls the application-defined
key handler.

This is still not optimal because we need to look up the key sequence
again in dispatch_key(). But since this is not a fast path anyway,
it should be OK.


No differences found