[Geany] Using Snippets

Enrico Tröger enrico.troeger at xxxxx
Sun Jan 4 14:56:54 UTC 2009


On Fri, 02 Jan 2009 19:40:21 +0100, Thomas Martitz <thomas47 at arcor.de>
wrote:

Hi,


>However, the current patch is far from intelligent and nice. It's a
>bit hackish (limited to 10 cursors, global struct in editor.c ...),
>and the next cursor movement is apparently broken once you hit tab
>normally between "jumps". To be investigated! Also, I changed the

Additionally, dmaphy pointed out another problem: when moving the
cursor backwards in a completed snippet and then jump to the next
defined cursor position, it's messed up.
Testcase:
Use the following snippet in some PHP code

class=class %cursor% \n{\n\tpublic function __construct(%cursor%)\n\t{\n
\t\t%cursor%\n\t}\n\n\tpublic function __destruct(%cursor%)\n\t{\n\t\t%
cursor%\n\t}\n\n\t%cursor%\n}

Then use the snippet: class<TAB>
and type "abcd" on the first cursor position, move the cursor back by
two positions and press the "Move cursor in snippet" keybinding to jump
to the next cursor position. The cursor is then inside "__construct"
instead of inside the braces.
Maybe we can live with that but it'd be better if it would be fixed
though this might be not easy.


>hotkey of "go to last used tab" to nothing, so that ctrl+tab is free
>for this (this is the best hotkey I can find for), feel free to
>discuss!

This was actually not so good and so I reverted in the attached patch.
The keybinding for "Go to last used tab" should be left unchanged, and
there is currently no default for the new keybinding. I personally used
Super-Tab which seems quite handy but not sure whether it should be the
default as I have no idea how many people actually have a Super key.


I also fixed a little bug where the cursor wasn't set correctly for
snippets like:

cur=%cursor%%brace_open%\n%brace_close%

The cursor should be before the braces but it was placed after.


Regards,
Enrico

-- 
Get my GPG key from http://www.uvena.de/pub.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: geany_snippet_cursor.patch
Type: text/x-diff
Size: 13186 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/users/attachments/20090104/2f832c55/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/users/attachments/20090104/2f832c55/attachment.pgp>


More information about the Users mailing list