codetools: fixed FindNextComment when MaxPos=0

git-svn-id: trunk@33066 -
This commit is contained in:
mattias 2011-10-24 15:54:14 +00:00
parent 794b3c6aec
commit d4e4fe6f3c

View File

@ -1153,7 +1153,7 @@ function FindNextComment(const ASource: string; StartPos: integer;
var
NotFoundPos: Integer;
begin
NotFoundPos:=MaxPos+1;
NotFoundPos:=MaxPos;
if (MaxPos>length(ASource)) or (MaxPos<1) then
MaxPos:=length(ASource);
Result:=StartPos;
@ -1185,7 +1185,7 @@ begin
end;
if Result>MaxPos then
if NotFoundPos>=1 then
Result:=NotFoundPos
Result:=NotFoundPos+1
else
Result:=MaxPos+1;
end;