codetools: clean up

git-svn-id: trunk@35734 -
This commit is contained in:
mattias 2012-03-05 14:28:42 +00:00
parent 34eceb1e57
commit e3eb046488

View File

@ -5018,30 +5018,32 @@ begin
if (Txt=nil) or (Txt^=#0) then exit; if (Txt=nil) or (Txt^=#0) then exit;
TxtRun:=Txt; TxtRun:=Txt;
StartChar:=SearchWord^; StartChar:=SearchWord^;
repeat while TxtRun^<>#0 do begin
while (TxtRun^<>StartChar) and (TxtRun^<>#0) do inc(TxtRun); if TxtRun^=StartChar then begin
if TxtRun^=#0 then exit; CurSearchP:=SearchWord+1;
CurSearchP:=SearchWord+1; CurTxtP:=TxtRun+1;
CurTxtP:=TxtRun+1; while (CurTxtP^=CurSearchP^) and (CurTxtP^<>#0) do begin
while (CurTxtP^=CurSearchP^) and (CurTxtP^<>#0) do begin inc(CurTxtP);
inc(CurTxtP); inc(CurSearchP);
inc(CurSearchP); end;
end; if CurSearchP^=#0 then begin
if CurSearchP^=#0 then begin // word found
// word found if ((TxtRun=Txt) or IsNonWordChar[TxtRun[-1]])
if ((TxtRun=Txt) or IsNonWordChar[TxtRun[-1]]) and IsNonWordChar[CurTxtP^] then begin
and IsNonWordChar[CurTxtP^] then begin // word boundaries
// word boundaries if not WholeWord then begin
if not WholeWord then begin WholeWord:=true;
WholeWord:=true; Count:=1;
Count:=1; end else
inc(Count);
end else end else
inc(Count); inc(Count);
end else TxtRun:=CurTxtP;
inc(Count); continue;
end;
end; end;
inc(TxtRun); inc(TxtRun);
until false; end;
end; end;
function SubString(p: PChar; Count: SizeInt): string; function SubString(p: PChar; Count: SizeInt): string;