IDE: Remember selection after moving an item in package editor. Issue #40135.

This commit is contained in:
Juha 2023-03-05 09:46:40 +02:00
parent 59babefde7
commit c8419bca6d
2 changed files with 5 additions and 4 deletions

View File

@ -398,8 +398,10 @@ end;
procedure TTreeFilterBranch.Move(CurIndex, NewIndex: integer);
begin
fOwner.StoreSelection;
fOriginalData.Move(CurIndex, NewIndex);
InvalidateBranch;
fOwner.RestoreSelection;
end;
{ TFileNameItem }
@ -562,7 +564,7 @@ begin
SelectNode:=Nil;
// ToDo: support more than one items or otherwise clean the code.
Assert(fSelectionList.Count < 2,
'TTreeFilterEdit.RestoreSelection: fSelectionList has more than one items.');
'TTreeFilterEdit.RestoreSelection: fSelectionList has more than one item.');
if fSelectionList.Count > 0 then
begin
CurText:=fSelectionList[0];

View File

@ -2478,7 +2478,8 @@ begin
FPropGui.SetDisableI18NCB(SelDisableI18NForLFM);
// move up/down (only single selection)
aVisible:=(not (SortAlphabetically or SingleSelectedRemoved))
aVisible := (FilterEdit.Filter='')
and (not (SortAlphabetically or SingleSelectedRemoved))
and ((SingleSelectedFile<>nil) or (SingleSelectedDep<>nil));
MoveUpBtn.Enabled :=aVisible and Assigned(SingleSelectedNode.GetPrevVisibleSibling);
MoveDownBtn.Enabled:=aVisible and Assigned(SingleSelectedNode.GetNextVisibleSibling);
@ -2989,7 +2990,6 @@ begin
FilesBranch.Move(OldIndex,NewIndex);
UpdatePEProperties;
UpdateStatusBar;
//FilterEdit.InvalidateFilter;
end;
procedure TPackageEditorForm.DoMoveDependency(Offset: integer);
@ -3012,7 +3012,6 @@ begin
RequiredBranch.Move(OldIndex,NewIndex);
UpdatePEProperties;
UpdateStatusBar;
//FilterEdit.InvalidateFilter;
end;
procedure TPackageEditorForm.DoSortFiles;