mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-10-01 05:23:56 +00:00
files-view: Check model empty selection after delayed signals emitted
When the user enter keystrokes to search, the first item sometimes gets deselected before being reselected. This is due to the gtk_bitset_is_empty check in display_pending_files, which occurs before the delayed clear signals are emitted. On the first display_pending_files call after the keystroke, there may still be a non-empty selection. Since the check happens before clear is emitted, we errorneously believe there was a selection so we do not select first until display_pending_files is called again. Move the no_selection bitset check to after we have emitted the delayed clear signal. Ensure there is at least 1 item in the model before we select the 0th index. Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/3420
This commit is contained in:
parent
93bccc3a5b
commit
09f4546d50
|
@ -774,7 +774,10 @@ static void
|
|||
nautilus_files_view_select_first (NautilusFilesView *self)
|
||||
{
|
||||
NautilusFilesViewPrivate *priv = nautilus_files_view_get_instance_private (self);
|
||||
nautilus_list_base_set_cursor (priv->list_base, 0, TRUE, TRUE);
|
||||
if (g_list_model_get_n_items (G_LIST_MODEL (priv->model)) > 0)
|
||||
{
|
||||
nautilus_list_base_set_cursor (priv->list_base, 0, TRUE, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -4451,11 +4454,14 @@ static void
|
|||
display_pending_files (NautilusFilesView *view)
|
||||
{
|
||||
NautilusFilesViewPrivate *priv = nautilus_files_view_get_instance_private (view);
|
||||
g_autoptr (GtkBitset) selection = gtk_selection_model_get_selection (GTK_SELECTION_MODEL (priv->model));
|
||||
gboolean no_selection = gtk_bitset_is_empty (selection);
|
||||
g_autoptr (GtkBitset) selection = NULL;
|
||||
gboolean no_selection = FALSE;
|
||||
|
||||
search_transition_emit_delayed_signals_if_pending (view);
|
||||
|
||||
selection = gtk_selection_model_get_selection (GTK_SELECTION_MODEL (priv->model));
|
||||
no_selection = gtk_bitset_is_empty (selection);
|
||||
|
||||
process_pending_files (view);
|
||||
|
||||
if (no_selection &&
|
||||
|
|
Loading…
Reference in a new issue