[Geany-devel] Autoclose mismatches

Lex Trotman elextr at xxxxx
Thu Feb 3 02:24:00 UTC 2011


On 3 February 2011 13:05, Jonathan Daily <biomathjdaily at gmail.com> wrote:
> I have noticed a similar issue that crops up when coding in several
> languages. I will start a function call that uses a second function as
> an input, and autoclose will take the first ')' as the close for the
> nested function call. Notepad++ has a preferences option to autoclose
> all brackets/quotes even if matched, and this is something that seems
> useful to me for geany.

Well that is the second part of the question, should it be checking
for matching at all??

As you say there is no way Geany can tell if the following close
bracket is intended to match the open you just added, or if the close
is intended to match an earlier open bracket.

Even if the problem of matching brackets in comments and strings is
fixed it will still often do the wrong thing.

So would it be better to just have autoclose off or on and not attempt
matching when it will often be wrong??

Any thoughts

Cheers
Lex

>
> On Wed, Feb 2, 2011 at 4:05 PM, Lex Trotman <elextr at gmail.com> wrote:
>> Hi all,
>>
>> It was raised in a recent thread and I vaguely remember raising it before.
>>
>> Autoclose incorrectly counts closes in comments and strings, ie a C
>> comment /* humorous blah :-) */
>> will match a ( entered before it.
>>
>> The editor.c/auto_close_char() uses Scintilla SCI_BRACEMATCH which
>> checks for the style being the same as the open character or past the
>> end of styling.
>>
>> The auto_close_char() function is called in on_char_added
>> notification, which according to Scintilla documentation:
>> "This notification is sent before the character has been styled so
>> processing that depends on styling should instead be performed in the
>> SCN_UPDATEUI notification."
>>
>> So I suggest auto_close_char() needs to be called from on_update_ui
>> like highlight_braces is.
>>
>> Cheers
>> Lex
>> _______________________________________________
>> Geany-devel mailing list
>> Geany-devel at uvena.de
>> http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
>>
>
>
>
> --
> ===============================================
> Jon Daily
> Technician
> ===============================================
> #!/usr/bin/env outside
> # It's great, trust me.
> _______________________________________________
> Geany-devel mailing list
> Geany-devel at uvena.de
> http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
>



More information about the Devel mailing list