[Geany-devel] "Auto-close quotes and brackets" - addition request

Enrico Tröger enrico.troeger at xxxxx
Mon Jan 12 21:10:04 UTC 2009

On Wed, 07 Jan 2009 23:40:52 -0500, "JGuillaume (ioguix) de Rorthais"
<ioguix at free.fr> wrote:

>Hash: SHA1
>Happy New Year to you guys ! Best wish to you and Geany :)
>In reply to this discussion on the geany list:
>I did my own version of the patch (in attachment). It still have
>following some flaws:
>- - when you insert an autoclosed char and immediatly delete it, the
>non-autoclose code kicks in anyway (I'm not sure how/where to deal
>with the delete keys)
>- - when inserting a quote (double or not), coming back before it and
>inserting another one, the non-autoclose code kicks in anyway. Should
>we test the next-char before non-autoclosing ?
>- - the test for matching bracket seems a bit too greedy as autoclose
>often doesn't kicks in because of a closing bracket few lines after.

Additional problems:
- the EditorInfo::autoclosed is not editor based so when inserting an
autoclose char in an editor, then change to another one, the
non-autoclose code kicks in when inserting the corresponding closing
char, the solution would be to move the 'autoclosed' field into the
GeanyEditor struct to make it editor-based but not sure whether it's
worth it (this then gets added to the plugin API or we create a
private part of GeanyEditor)
- insert a '(', the ')' gets auto-inserted, move the cursor behind the
auto-inserted ')' and insert another ')', the inserted closing brace is
deleted by the non-autoclose code and the cursor is positioned off by

This all seems kind of weird and hard to fix all cases. I'm afraid a
sane implementation would cause a painful amount of extra code :(.


Get my GPG key from http://www.uvena.de/pub.asc
-------------- 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/devel/attachments/20090112/bc51ba2f/attachment.pgp>

More information about the Devel mailing list