How come BraceMatch() doesn't work when a lexer is set in wxStyledTextCtrl?

Posted by George Edison on Stack Overflow See other posts from Stack Overflow or by George Edison
Published on 2010-03-21T00:47:26Z Indexed on 2010/03/21 0:51 UTC
Read the original article Hit count: 349

I have the following chunk of C++ code that gets called when } is pressed:

int iCurPos = GetCurrentPos();

InsertText(iCurPos,wxT("}"));

int iPos = BraceMatch(iCurPos);

This works fine (iPos gets the position of the matching brace) except when I call SetLexer(...) beforehand. Then it returns -1? How can I get it to work?

Edit: I should point out that the above code is being called from the EVT_KEY_DOWN handler in a wxStyledTextCtrl-derived class.

© Stack Overflow or respective owner

Related posts about wxwidgets

Related posts about wxstyledtextctrl