[Geany-devel] snippet keybindings? - Re: [PATCH] Some editor/snippets/keybindings enhancements

Eugene Arshinov earshinov at xxxxx
Sun Aug 29 17:35:35 UTC 2010


On Wed, 18 Aug 2010 09:56:45 +1000%
Lex Trotman <elextr at gmail.com> wrote:

> On 18 August 2010 00:35, Nick Treleaven
> <nick.treleaven at btinternet.com> wrote:
> > On Tue, 17 Aug 2010 10:08:08 +1000
> > Lex Trotman <elextr at 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#e8eeecc54d81ce05457e04ad98028a68
> 
> 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: geany.20.alt_snippet_keybindings.r5065.patch
Type: text/x-patch
Size: 16609 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20100829/6571b1bb/attachment.bin>


More information about the Devel mailing list