Code: Select all
tot_kwds := 0;
for wd_ndx := 0 to cklist.Count-1 do begin
// 1
if not CurrFileData.ContainsWord( cklist.Items[wd_ndx] ) then
continue;
rve.SetSelectionBounds(0, rve.GetOffsBeforeItem(0), 0, rve.GetOffsBeforeItem(0));
while rve.SearchText( cklist.Items[wd_ndx], [rvseoDown,rvseoWholeWord]) do begin
inc( tot_kwds );
// . . .
end;
end;
I ran into a problem where SearchText was getting hung up not finding a word that wasn't there, so I added a test (below the line marked "//1" ) to see if the word was even there first. This worked in that case (maybe?).
But after a while, I ran into two situations where SearchText would get hung up searching for a word that DOES exist.
By "hung up" I mean it never returns false. After a few seconds of 100% CPU activity, I put a breakpoint at the line "inc( tot_kwds )" and it invariable shows that tot_kwds is > 10,000, which in the data I'm using is simply impossible -- the input data consists of text files that are 400-800 words in length and there aren't more than a dozen or so instances of any given keyword. Most of the keywords have zero occurrences, and most of the rest have 1 or 2. The word list itself is around 200 or so.
I tried to trace it through and track down the problem, but it seems to be intermittent. So I figured I'd just report the symptoms and ask if there's something I can test within the loop to see if it's finished and I can break out of the loop anyway.
Thanks
David