On Sun, 29 Aug 2010 21:35:35 +0400% Eugene Arshinov earshinov@gmail.com wrote:
On Wed, 18 Aug 2010 09:56:45 +1000% Lex Trotman elextr@gmail.com wrote:
On 18 August 2010 00:35, Nick Treleaven nick.treleaven@btinternet.com wrote:
On Tue, 17 Aug 2010 10:08:08 +1000 Lex Trotman elextr@gmail.com wrote:
If we do want snippet keybindings perhaps it would be better to integrate with the existing keybindings rather than storing them separately - then users could configure them in the normal way.
It's worth thinking.
This could be a bit of work since the number of snippets is variable and the keybindings GUI is fixed. I had a quick look a while ago with the view of allowing the extra build commands to have keybindings but never came up with a simple way of handling variable numbers of commands.
If you decide to add a general way of adding variable numbers of entries in the keybindings GUI it could then be used elsewhere.
Plugins can change the number of keybindings in their plugin's key group*, so maybe this could be done for other things in the core. It would probably only take some small changes. 'Format->Send selection to' keybindings could be variable size too.
http://www.geany.org/manual/reference/pluginutils_8h.html#e8eeecc54d81ce0545...
Looks like a good solution, I never thought of looking in the plugin interface.
Here is the new patch. It seems to be not so simple and clean as the previous one, but now keybindings are edited in Preferences dialog as (I believe) most users prefer.
Unfortunately, keybindings_set_item was not enough for me to implement this. For example, I had to extend GeanyKeyGroup struct so that I have a way to tweak loading from / saving to keybindings.conf. Anyway, any suggestions about how to improve the patch are welcome.
Currently there are two little problems
All underscores from keybinding names are removed (I wonder why), so names of some "special" snippets are displayed incorrectly (**)
Editing of keybindings in the Preferences dialog isn't "caught" completely by Geany. For example, if I remove a keybinding using click - BackSpace - Enter and press OK, Geany thinks I edited
nothing and does not update keybindings.conf. Though, as expected, the removed keybinding no longer functions.
** and users are allowed to assign keybindings for "special" snippets
I finished this patch today, so I hadn't much time for testing. As for now, everything except the two issues above seems to work fine.
Best regards, Eugene.
Sorry, that patch is a little outdated. Here is the last version.