IDE In search results window, do not expand nodes when switching tabs. Issue #41259.

This commit is contained in:
Juha 2024-11-30 14:03:36 +02:00
parent e1aff780f0
commit d326f3e9e7
4 changed files with 19 additions and 8 deletions

View File

@ -82,8 +82,8 @@ type
fFirstPassedNode: TTreeNode;
fOnGetImageIndex: TImageIndexEvent;
fOnFilterNode: TFilterNodeEvent;
procedure SetFilteredTreeview(const AValue: TCustomTreeview);
procedure SetShowDirHierarchy(const AValue: Boolean);
procedure SetFilteredTreeview(AValue: TCustomTreeview);
procedure SetShowDirHierarchy(AValue: Boolean);
function FilterTree(Node: TTreeNode): Boolean;
procedure OnBeforeTreeDestroy(Sender: TObject);
protected
@ -102,6 +102,7 @@ type
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure SetTreeFilterSilently(ATree: TCustomTreeview; AFilter: string);
procedure StoreSelection; override;
procedure RestoreSelection; override;
function GetExistingBranch(ARootNode: TTreeNode): TTreeFilterBranch;
@ -446,7 +447,7 @@ begin
FreeAndNil(fBranches);
end;
procedure TTreeFilterEdit.SetFilteredTreeview(const AValue: TCustomTreeview);
procedure TTreeFilterEdit.SetFilteredTreeview(AValue: TCustomTreeview);
begin
if fFilteredTreeview = AValue then Exit;
if fFilteredTreeview <> nil then
@ -463,7 +464,16 @@ begin
end;
end;
procedure TTreeFilterEdit.SetShowDirHierarchy(const AValue: Boolean);
procedure TTreeFilterEdit.SetTreeFilterSilently(ATree: TCustomTreeview; AFilter: string);
begin // The tree is already filtered, the same FilterEdit is used for many.
fAlreadyFiltered:=True;
SetFilteredTreeview(ATree);
InternalSetFilter(AFilter);
fAlreadyFiltered:=False;
Text:=AFilter; // This will trigger filtering if Text differs from AFilter.
end;
procedure TTreeFilterEdit.SetShowDirHierarchy(AValue: Boolean);
begin
if fShowDirHierarchy=AValue then exit;
if not Assigned(fFilteredTreeview) then

View File

@ -10,9 +10,9 @@ object SearchResultsView: TSearchResultsView
Constraints.MinHeight = 100
Constraints.MinWidth = 400
KeyPreview = True
LCLVersion = '4.99.0.0'
OnCreate = Form1Create
OnKeyDown = FormKeyDown
LCLVersion = '2.3.0.0'
object ControlBar1: TPanel
Left = 0
Height = 26

View File

@ -798,8 +798,7 @@ begin
lTree := GetCurrentTree;
if assigned(lTree) and not (csDestroying in lTree.ComponentState) then
begin
SearchInListEdit.FilteredTreeview := lTree;
SearchInListEdit.Filter := lTree.SearchInListPhrases;
SearchInListEdit.SetTreeFilterSilently(lTree, lTree.SearchInListPhrases);
if FFocusTreeViewInOnChange then
ActivateControl(lTree);
end;

View File

@ -241,8 +241,9 @@ type
procedure OnAsync(Data: PtrInt);
function IsTextHintStored: Boolean;
protected
fNeedUpdate: Boolean;
fAlreadyFiltered: Boolean;
fIsFirstUpdate: Boolean;
fNeedUpdate: Boolean;
fSelectedPart: TObject; // Select this node on next update
fOnFilterItem: TFilterItemEvent;
fOnFilterItemEx: TFilterItemExEvent;
@ -1348,6 +1349,7 @@ end;
procedure TCustomControlFilterEdit.InvalidateFilter;
begin
if fAlreadyFiltered then Exit;
fNeedUpdate:=true;
IdleConnected:=true;
end;