I'd like to make the comment/uncomment commands on the editor menu use lexer specific comments rather than "//"
the current code for uncomment is:
while( startLine <= endLine )
{
// For each line: if it is commented, uncomment.
wxString strLine = stc->GetLine( startLine );
wxString Comment = _T("//");
int commentPos = strLine.Strip( wxString::leading ).Find( Comment );
if( commentPos == 0 )
{ // we know the comment is there (maybe preceded by white space)
int Pos = strLine.Find(Comment);
int start = stc->PositionFromLine( startLine ) + Pos;
int end = start + Comment.Length();
stc->SetTargetStart( start );
stc->SetTargetEnd( end );
stc->ReplaceTarget( wxEmptyString );
}
++startLine;
} // end while
it looks like this is just a simple matter of replacing Comment= _T("//") with a lookup to the Scintilla lexer...
is there an easy way to grab the comment token(s) from the currently active Scintilla lexer?
In addition, I'd like to add some "smart editor" features when editing python code. Most important of these is to indent one level deeper after pressing Return/Enter on a line ending in ":" . Can someone recommend an easy way to do this/some related code to look at? Should I do it in a separate plugin (i.e. in my python plugin) or in the core C::B code?