anchor.diff:    wordList : TStringList;
     wordidx, wordcnt : integer;
     MultiMatchOK : boolean;
  -  ApplyFilter: boolean;         // [dpv]
  -  nodeToFilter: boolean;        // [dpv]
  -  nodesSelected: boolean;       // [dpv]
  +  ApplyFilter: boolean;
  +  nodeToFilter: boolean;
  +  nodesSelected: boolean;
     oldActiveNote: TTabNote;
   
  -        procedure AddLocation; // INLINE
  -        var
  -          path : wideString;
  -        begin
  -          if assigned( myTreeNode ) then
  -          begin
  -            if ApplyFilter and (not nodesSelected) then      // [dpv] Only once per note
  +type
  +   TLocationType= (lsNormal, lsNodeName, lsMultimatch);
  +
  +       procedure AddLocation (LocationType: TLocationType); // INLINE
  +       var
  +         path : wideString;
  +       begin
  +          Location := TLocation.Create;
  +          Location.FileName := Notefile.FileName;
  +          Location.NoteName := myNote.Name;
  +          Location.NoteID := myNote.ID;
  +
  +          if assigned(myTreeNode) then begin
  +             myNoteNode := TNoteNode(myTreeNode.Data);
  +             Location.NodeName := myNoteNode.Name;
  +             Location.NodeID := myNoteNode.ID;
  +          end;
  +
  +          case LocationType of
  +             lsNormal: begin
  +                 Location.CaretPos := PatternPos;
  +                 Location.SelLength := PatternLen;
  +                 end;
  +             lsNodeName: begin
  +                 Location.CaretPos := -1; // means: text found in node name
  +                 Location.SelLength := 0;
  +                 end;
  +             lsMultimatch: begin
  +                 Location.CaretPos := 0;
  +                 Location.SelLength := 0;
  +                 end;
  +          end;
  +
  +          if assigned( myTreeNode ) then begin
  +            if ApplyFilter and (not nodesSelected) then     // Only once per note
                  MarkAllFiltered(myTNote);           // There will be at least one node in the selection
  -            nodeToFilter:= false;      // [dpv]
  -            nodesSelected:= true;      // [dpv]
  +            nodeToFilter:= false;
  +            nodesSelected:= true;
             end;
             path := WideFormat( '%d. %s', [Counter, PathOfKNTLink(myTreeNode, myNote, location.CaretPos)] );
  -
  -          Location_List.AddObject(
  -            path,
  -            Location
  -          );
  -        end; // AddLocation
  +          Location_List.AddObject(path, Location);
  +       end;
  +
  +       procedure GetFirstNode;
  +       begin
  +          if myNote.Kind <> ntTree then exit;
  +
  +          myTreeNode := TTreeNote(myNote).TV.Items.GetFirstNode;
  +          if assigned( myTreeNode ) and myTreeNode.Hidden and (not FindOptions.HiddenNodes) then
  +             myTreeNode := myTreeNode.GetNextNotHidden;
  +       end;
  +
  +       procedure GetNextNode;
  +       begin
  +          if (myNote.Kind <> ntTree) or (not assigned(myTreeNode)) then exit;
  +
  +          if FindOptions.HiddenNodes then     // [dpv]
  +             myTreeNode := myTreeNode.GetNext
  +          else
  +             myTreeNode := myTreeNode.GetNextNotHidden;
  +       end;
  +
  +       procedure GetNextNote;
  +       begin
  +          if FindOptions.AllTabs then begin
  +             inc( noteidx );
  +
  +             if ( noteidx >= NoteFile.NoteCount ) then
  +                FindDone := true
  +             else begin
  +                myNote := TTabNote(Form_Main.Pages.Pages[noteidx].PrimaryObject);
  +                if myNote.Kind = ntTree then
  +                   GetFirstNode;
  +                end;
  +          end
  +          else
  +            FindDone := true;
  +       end;
  +
  +
   begin
   
     if ( not Form_Main.HaveNotes( true, true )) then exit;
  
positive.code:   noteidx, i, MatchCount, Counter, PatternPos, PatternLen, SearchOrigin : integer;
    myNote : TTabNote;
    myTreeNode : TTreeNTNode;
    myTNote: TTreeNote;         // [dpv]
    myNoteNode : TNoteNode;
    lastNoteID, lastNodeID : integer;
    lastTag : integer;
  
negative.code: 
              if PatternPos < 0 then begin
                 GetNextNode;                 // Podr actualizar FindDone
                 while (not FindDone) and (not assigned(myTreeNode)) do begin
                     GetNextNote();
                     if (myNote.Kind <> ntTree) then break;
                 end;
              end;
              Application.ProcessMessages;    // Para permitir que el usuario cancele (UserBreak)
  
  