1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:58:11 +00:00

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
parent 440f017946
commit 0ec37c0d64

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;