list-base: Allow to tab directly out of view

Now that the views contain real widgets, Tab and Shift+Tab cycle
through every item and only allow leaving the view when at the
end or start of the list, respectively.

This is frustrating for directories with more than a handful of files.
Also, users expect to use arrow keys to cycle though items already.

So, allow to tab into and out of the view, but not inside.
This commit is contained in:
António Fernandes 2022-12-23 16:40:39 +00:00
parent fcbfb284e3
commit 77cd0f94b7

View file

@ -1710,6 +1710,17 @@ nautilus_list_base_focus (GtkWidget *widget,
gboolean no_selection;
gboolean handled;
/* If focus is already inside the view, allow to immediately tab out of it,
* instead of having to cycle through every item (potentially many). */
if (direction == GTK_DIR_TAB_FORWARD || direction == GTK_DIR_TAB_BACKWARD)
{
GtkWidget *focus_widget = gtk_root_get_focus (gtk_widget_get_root (widget));
if (focus_widget != NULL && gtk_widget_is_ancestor (focus_widget, widget))
{
return FALSE;
}
}
selection = nautilus_view_get_selection (NAUTILUS_VIEW (self));
no_selection = (selection == NULL);