diff --git a/AutoDoxyDoc/DoxygenCompletionCommandHandler.cs b/AutoDoxyDoc/DoxygenCompletionCommandHandler.cs index a2af323..b22120e 100644 --- a/AutoDoxyDoc/DoxygenCompletionCommandHandler.cs +++ b/AutoDoxyDoc/DoxygenCompletionCommandHandler.cs @@ -241,7 +241,7 @@ private void NewCommentLine(string currentLine) int oldOffset = ts.ActivePoint.LineCharOffset; int extraIndent = 0; - while (!currentLine.StartsWith("/*!")) + while (!currentLine.StartsWith("/*")) { if (m_regexTagSection.IsMatch(currentLine)) { @@ -249,6 +249,12 @@ private void NewCommentLine(string currentLine) break; } + // protect from infinite loop when we reach the top of the document an end of comment + // the NewCommentLine() call is protected with a weak IsInsideComment() check + // that could be flawed with lines like: *pointer = value; + if (ts.ActivePoint.Line <= 1 || currentLine.Contains("*/")) + return; + ts.LineUp(); currentLine = ts.ActivePoint.CreateEditPoint().GetLines(ts.ActivePoint.Line, ts.ActivePoint.Line + 1); currentLine = currentLine.TrimStart();