On Sun, 29 Aug 2010 21:59:32 +0400 Eugene Arshinov earshinov@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.
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.
OK, I didn't explain before what I had in mind but I think this patch is too complex.
What I think we could accept is setting up the snippet keybinding group size and items (like a plugin) when snippets.conf is read, using any defaults found in the file. I don't think we should write to snippets.conf. If the user wants to set the keybinding in snippets.conf, then they must remember that it won't be kept in sync with keybindings.conf. This should make the code simpler.
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 (**)
** and users are allowed to assign keybindings for "special" snippets
This is so a menu item string with underscores for mnemonics can be reused without adding a translation string but without displaying the underscore mnemonics for the keybindings dialog.
This could be fixed by adding a keygroup field 'translatable', on by default.
- 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.
I can't reproduce this as described.
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.
Regards, Nick