Ignore:
Timestamp:
Aug 31, 2008, 2:01:55 PM (17 years ago)
Author:
RBRi
Message:

search bug fix; more logging

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.19_branch/NewView/HelpTopic.pas

    r290 r333  
    14601460                                ): longint;
    14611461var
    1462   WordSequence: TList;
    1463   SequenceStepIndex: longint;
     1462  tmpWordSequence: TList;
     1463  tmpSequenceStepIndex: longint;
    14641464  pSequenceStepWords: Uint32ArrayPointer;
    14651465
     
    14761476  for SequenceIndex := 0 to WordSequences.Count - 1 do
    14771477  begin
    1478     WordSequence := WordSequences[ SequenceIndex ];
    1479     pSequenceStepWords := WordSequence[ 0 ];
     1478    tmpWordSequence := WordSequences[ SequenceIndex ];
     1479    pSequenceStepWords := tmpWordSequence[ 0 ];
    14801480
    14811481    if pSequenceStepWords^[ GlobalDictIndex ] > 0 then
    14821482    begin
    14831483      // matched first step in this sequence. Look ahead...
    1484 
    1485       SequenceStepIndex := 0;
     1484      tmpSequenceStepIndex := 1;
    14861485
    14871486      pDataTemp := pData;
    14881487      SlotIndexTemp := SlotIndex;
    14891488      StateTemp := State;
     1489
    14901490      while true do
    14911491      begin
    1492         inc( SequenceStepIndex );
    1493         if SequenceStepIndex = WordSequence.Count then
    1494         begin
    1495           // have a match for the sequence, insert start highlight
    1496           Result := WordSequence.Count;
     1492        if tmpSequenceStepIndex = tmpWordSequence.Count then
     1493        begin
     1494          // have a match for the sequence; time to leave
     1495          Result := tmpWordSequence.Count;
    14971496          break;
    14981497        end;
    14991498
    15001499        // get words for next step in sequence
    1501         pSequenceStepWords := WordSequence[ SequenceStepIndex ];
    1502 
    1503         DictIndex := GetNextIPFTextItem( SlotIndexTemp,
    1504                                          pDataTemp,
    1505                                          StateTemp );
     1500        pSequenceStepWords := tmpWordSequence[ tmpSequenceStepIndex ];
     1501
     1502        DictIndex := GetNextIPFTextItem( SlotIndexTemp, pDataTemp, StateTemp );
    15061503        if DictIndex = -2 then
    15071504        begin
     
    15181515
    15191516        // s := pstring( _GlobalDictionary[ DictIndex ] )^; // for debug only
     1517
     1518
     1519        // ignore whitespace
    15201520        if not StrIsEmptyOrSpaces( pstring( _GlobalDictionary[ DictIndex ] )^ ) then
    15211521        begin
     
    15251525            break;
    15261526          end;
     1527
     1528          // match; next one
     1529          inc(tmpSequenceStepIndex);
    15271530        end;
    15281531
     
    15331536  end; // for sequenceindex ...
    15341537end;
     1538
    15351539
    15361540// Main translation function. Turns the IPF data into
     
    16371641
    16381642        if ShowWordSeparators then
     1643        begin
    16391644          Text.AddString( '{' + IntToStr( GlobalDictIndex )+ '}' );
     1645        end;
    16401646
    16411647        // normal lookup
     
    16561662          // store string into "word"
    16571663          if State.TextBlock.Length = 0 then
     1664          begin
    16581665            // store start of block
    16591666            State.StartOfTextBlock := Text.Length;
     1667          end;
    16601668
    16611669          State.TextBlock.AddString( StringToAdd );
     
    16721680              begin
    16731681                // now finished, insert end highlight
    1674                 StringToAdd := StringToAdd
    1675                                + State.BackgroundColorTag;
    1676 
     1682                StringToAdd := StringToAdd + State.BackgroundColorTag;
    16771683              end;
    16781684            end
     
    16991705                if SequenceStepIndex = 0 then
    17001706                  // and ends it.
    1701                   StringToAdd := StringToAdd
    1702                            + State.BackgroundColorTag;
     1707                  StringToAdd := StringToAdd + State.BackgroundColorTag;
    17031708              end;
    17041709
     
    18211826  end;
    18221827  State.TextBlock.Destroy;
    1823 
    1824 end;
     1828end;
     1829
    18251830
    18261831function TTopic.SearchForWord( DictIndex: integer;
Note: See TracChangeset for help on using the changeset viewer.