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
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.
On Wed, Feb 2, 2011 at 4:05 PM, Lex Trotman elextr@gmail.com wrote:
On 3 February 2011 13:05, Jonathan Daily biomathjdaily@gmail.com wrote:
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
I think having autoclose as an off/on rather than a guess would be more useful. What would make more sense to me as an option would be what to autoclose, having options for (), [], {}, <>, ''. and "", possibly using autodetection (for <> at least). I can't speak for the majority, however, as I code mostly in python, xml, and R.
On Wed, Feb 2, 2011 at 9:24 PM, Lex Trotman elextr@gmail.com wrote: