[Geany-devel] keybinding order issues
Nick Treleaven
nick.treleaven at xxxxx
Mon Jul 7 10:48:10 UTC 2008
On Sun, 6 Jul 2008 20:18:25 +0200
Enrico Tröger <enrico.troeger at uvena.de> wrote:
> On Fri, 4 Jul 2008 15:26:28 +0100, Nick Treleaven
> <nick.treleaven at btinternet.com> wrote:
>
> > keygroups[KEY_GROUP_SOME]->keys[KEYS_SOME_COMMAND]->id =
> > GEANY_KEYS_SOME_COMMAND;
> >
> > Then keybindings_send_command() would search for that id in
> > keygroups[x]->keys[y]. Although that's a relatively slow search
> > algorithm, it probably wouldn't matter here. If necessary it could
> > be optimized to use a hash/lookup table.
>
> My first thought was the search algorithm wouldn't matter at all as we
> don't have that many keybindings. But indeed, we have 110 (!)
> keybindings.
> Anyway, 100 integer comparisons aren't that expensive and should be ok
> at least for now. As you said, it could be improved later.
I think keybindings_send_command() is only used as a single call, such
as to hide the sidebar in response to a menu item (e.g. file browser
plugin). keybindings_got_event() would still iterate through the
keybinding groups as usual.
But anyway, I hadn't really thought about the implementation of
keybindings_send_command(), it can easily be done efficiently with a
separate array:
key_commands[GEANY_KEYS_SOME_COMMAND] = keygroups[KEY_GROUP_SOME]->keys
[KEYS_SOME_COMMAND];
I don't think these core changes require too much work, but I'll work
on the GeanyEditor* changes first, as these are more important.
Regards,
Nick
More information about the Devel
mailing list