On Wed, 07 Jan 2009 23:40:52 -0500, "JGuillaume (ioguix) de Rorthais" ioguix@free.fr wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hi,
Happy New Year to you guys ! Best wish to you and Geany :)
In reply to this discussion on the geany list: http://lists.uvena.de/pipermail/geany/2008-December/003878.html
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 one
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 :(.
Regards, Enrico