> Dear community
>
> I've been reported a problem with brace matching in Notepad2 (running
> on Windows XP, using Scintilla 1.73, also tested with 1.74) which I'm
> not able to track down, myself.
>
> Given the construct below (working in HTML mode, but I've been able to
> produce similar cases with other lexers):
>
> <?php
> if($expr == true)
> # }
> }
> ?>
We also have an intermittent brace matching problem in our Javelin (Java
Lexer) and Visual Classworks (C++ Lexer) projects. When editing methods
these tools do a check to see that all braces are matched before
committing changes to the underlying source code. We use brace matching
on the first { and then on the last } in the method as a simple test to
see if the braces are matched.
Very occassionally after modifying the code a brace mismatch message is
displayed (even though all braces match) - but if you move the cursor
around a bit (without making any changes to the code) and then try to
commit again the brace matching test succeeds and all is well - the only
thing that has happened is that the cursor has been moved to a different
position - strange!
I'd be interested in any findings in this area.
>
> Inserting an opening curly brace after the if() statement will
> highlight the newly inserted brace along with the (incorrect)
> counterpart after the #. When moving the caret and hitting the same
> brace again, the highlighting is performed properly, the error occurs
> only with newly added braces.
>
> The logic of Notepad2 to handle brace highlighting is the following:
>
> case SCN_UPDATEUI:
>
> iPos = SendMessage(hwnd,SCI_GETCURRENTPOS,0,0);
> chBr = (char)SendMessage(hwnd,SCI_GETCHARAT,iPos,0);
> if (StrChr("()[]{}",chBr)) {
> int iBrace2 = SendMessage(hwnd,SCI_BRACEMATCH,iPos,0);
> if (iBrace2 != -1)
> SendMessage(hwnd,SCI_BRACEHIGHLIGHT,iPos,iBrace2);
> else
> SendMessage(hwnd,SCI_BRACEBADLIGHT,iPos,0);
>
> I feel that this problem has something to do with styling not yet
> finished, as the documentation for SCI_BRACEMATCH says "A match only
> occurs ... or the matching brace is beyond the end of styling". But
> the color display of the example code above is always correct, just
> the brace matching is wrong.
>
> Comparing the Notepad2 code with the implementation of SciTE, I can
> see that the latter also performs highlighting of the indent guide,
> and does some style checks using a WindowAccessor object, but I still
> don't see what I'm missing.
>
> If somebody familiar with this problem could give me a hint how to
> solve it, I'd be very grateful!
>
> Greetings
> --Florian
> _______________________________________________
> Scintilla-interest mailing list
> [email protected]
> http://mailman.lyra.org/mailman/listinfo/scintilla-interest
_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest