views:

13

answers:

0

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 if that helps.

Is this a known bug?