mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-28 07:37:27 +01:00
codeexplorer: CodeExplorerView.FindCodeTVNodeAtCleanPos: find deepest node
git-svn-id: trunk@26326 -
This commit is contained in:
parent
ae014f642c
commit
fd5a10c132
@ -1990,6 +1990,8 @@ var
|
||||
KeyPos: integer;
|
||||
AVLNode: TAvgLvlTreeNode;
|
||||
Node: TTreeNode;
|
||||
NodeData: TViewNodeData;
|
||||
BestData: TViewNodeData;
|
||||
begin
|
||||
Result:=nil;
|
||||
if (fLastCodeTool=nil) or (not FLastCodeValid) or (CodeTreeview=nil)
|
||||
@ -1997,10 +1999,23 @@ begin
|
||||
KeyPos:=CleanPos;
|
||||
AVLNode:=fCodeSortedForStartPos.FindLeftMostKey(@KeyPos,
|
||||
TListSortCompare(@CompareStartPosWithViewNodeData));
|
||||
if AVLNode=nil then exit;
|
||||
Node:=TTreeNode(AVLNode.Data);
|
||||
// ToDo: find the shortest
|
||||
Result:=Node;
|
||||
// find the shortest
|
||||
BestData:=nil;
|
||||
Result:=nil;
|
||||
while AVLNode<>nil do begin
|
||||
Node:=TTreeNode(AVLNode.Data);
|
||||
if TObject(Node.Data) is TViewNodeData then begin
|
||||
NodeData:=TViewNodeData(Node.Data);
|
||||
if (BestData=nil)
|
||||
or ((BestData.StartPos<=NodeData.StartPos)
|
||||
and (BestData.EndPos>=NodeData.EndPos))
|
||||
then begin
|
||||
Result:=Node;
|
||||
BestData:=TViewNodeData(Node.Data);
|
||||
end;
|
||||
end;
|
||||
AVLNode:=fCodeSortedForStartPos.FindSuccessor(AVLNode);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCodeExplorerView.BuildCodeSortedForStartPos;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user