Skip to content

Commit 075e1e0

Browse files
committed
fix: keep sort order when switching folders in file dialog
1 parent 5a619d6 commit 075e1e0

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎source/extfiledialog.pas‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,12 @@ procedure TfrmExtFileDialog.ShellTreeViewChange(Sender: TObject; Node: TTreeNode
497497
);
498498
begin
499499
lblPath.Caption := ShellTreeView.Path;
500+
// Re-apply the current sorting after the list was repopulated: PopulateWithRoot's
501+
// internal Sort is skipped while the list view is in BeginUpdate (SetRoot), so a
502+
// folder change would leave the items in raw FindFirst order although the header
503+
// still shows the sort indicator. OnChange fires after the repopulation, so this
504+
// is the right place to sort again.
505+
ShellListView.Sort;
500506
end;
501507

502508
procedure TfrmExtFileDialog.ShellTreeViewChanging(Sender: TObject;

0 commit comments

Comments
 (0)