summaryrefslogtreecommitdiff
path: root/src/file-manager/fm-list-view.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/file-manager/fm-list-view.c')
-rw-r--r--src/file-manager/fm-list-view.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/file-manager/fm-list-view.c b/src/file-manager/fm-list-view.c
index 294159a0..7e1b5e73 100644
--- a/src/file-manager/fm-list-view.c
+++ b/src/file-manager/fm-list-view.c
@@ -1124,7 +1124,15 @@ key_press_callback (GtkWidget *widget, GdkEventKey *event, gpointer callback_dat
gtk_tree_view_get_cursor (tree_view, &path, NULL);
if (path)
{
- gtk_tree_view_collapse_row (tree_view, path);
+ if (!gtk_tree_view_collapse_row (tree_view, path)) {
+ /* if the row is already collapsed or doesn't have any children,
+ * jump to the parent row instead.
+ */
+ if ((gtk_tree_path_get_depth (path) > 1) && gtk_tree_path_up (path)) {
+ gtk_tree_view_set_cursor (tree_view, path, NULL, FALSE);
+ }
+ }
+
gtk_tree_path_free (path);
}
handled = TRUE;