for those interested, attached zip file contains a simple main.cpp.
Put your cursor at the start of the (first) line and select the uncomment command --> you can see the problem ;-)
Here's a little modified part of the codfe from (the CB source that is) main.cpp::MainFrame::OnEditUncommentSelected()
In comments I have put the values from the debugger in the above example :
int commentPos = strLine.Strip( wxString::leading ).Find( Comment );
if( commentPos ==0 )
{
// Uncomment
strLine.Replace( Comment, _T( "" ), false );
// Update
int start = stc->PositionFromLine( startLine ); // 0
stc->SetTargetStart( start );
// adjust for the '//' we erased
int x = strLine.Length(); // 18
int y = Comment.Length(); // 2
stc->SetTargetEnd( start + strLine.Length() + Comment.Length() ); // 20
stc->ReplaceTarget( strLine );
}
These values seems correct, but after the stc->ReplaceTarget the damage is done.
I'll try to test if it works with the new wxScintilla, but I have already a workaround in mind which I am gonna try out first.
Note that "commenting" the line works, for that purpose stc->InsertText was used, and that seems to work well.
[attachment deleted by admin]