FileManager: Ignore empty selections on tree view

If the selection is empty, the model index will be invalid and the file
system model will return the root directory path by default. This causes
the file manager to jump to the root directory when the currently
selected item on the tree view is deselected.
This commit is contained in:
angel 2020-04-19 15:11:43 +02:00 committed by Andreas Kling
commit 0ec37c0d64
Notes: sideshowbarker 2024-07-19 17:36:10 +09:00

View file

@ -702,6 +702,8 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio
};
tree_view.on_selection_change = [&] {
if (tree_view.selection().is_empty())
return;
auto path = directories_model->full_path(tree_view.selection().first());
if (directory_view.path() == path)
return;