If someone uses DoxyBlocks to create a block comment, it'll usually have some trailing white-space after the comment.
A patch like this fixes this:
src/plugins/contrib/DoxyBlocks/AutoDoc.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/plugins/contrib/DoxyBlocks/AutoDoc.cpp b/src/plugins/contrib/DoxyBlocks/AutoDoc.cpp
index c2e08ee..28fb499 100644
--- a/src/plugins/contrib/DoxyBlocks/AutoDoc.cpp
+++ b/src/plugins/contrib/DoxyBlocks/AutoDoc.cpp
@@ -422,8 +422,8 @@ void DoxyBlocks::AddCommentLine(cbStyledTextCtrl *control, int& iPos, wxString s
{
// Use NewLine() to get the correct line ending chars.
control->NewLine();
+ control->DelLineLeft(); // clears any indentation
iPos = control->PositionFromLine(control->GetCurrentLine());
- control->GotoPos(iPos);
control->AddText(sText);
}
Which triggered one question... if "NewLine()" causes automated indentation and that's the reason why
GotoPos() was used in first place
(without my change and no GotoPos(), you'll end up with increasing indentation)Why is it actually used everywhere around? or more specifically, why is "iPos" stored in a shared variable as it's not really used anywhere and seems quite unnecessary...
So why not get rid of iPos entirely? Does anyone see a real use for it?
Btw, the following code used some alternate bizarre approach to get rid of indentation:
void DoxyBlocks::StartComment(cbStyledTextCtrl *control, int &iPos, int iBlockComment, wxString sStartComment, wxString sMidComment, wxString sTagBrief, wxString sIndent)
{
wxString sSpace(wxT(" "));
control->GotoPos(iPos);
// Doing this first prevents me ending up with the function declaration indented i.e. I work in the blank line.
control->NewLine();
control->LineUp();
if (iBlockComment == 4 || iBlockComment == 5)
{
control->AddText(sIndent + sStartComment);
control->NewLine();
iPos = control->PositionFromLine(control->GetCurrentLine());
control->AddText(sIndent + sMidComment + sTagBrief + sSpace);
}
else
control->AddText(sIndent + sStartComment + sTagBrief + sSpace);
}
It basically goes to the beginning of the line
(#5), triggers a new line
(#7) there
(without indentation because spaces would follow and are instead moved to the next line) and then moves up to get a line without indentation
(#8)...