Skip to content

Commit

Permalink
trial: opening first result on Enter
Browse files Browse the repository at this point in the history
  • Loading branch information
porridgewithraisins committed Sep 28, 2024
1 parent f0f6ec4 commit 847a545
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/fsearch_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,18 @@ on_search_entry_key_press_event(GtkWidget *widget, GdkEvent *event, gpointer use
fsearch_list_view_set_cursor(win->result_view->list_view, cursor_idx);
return TRUE;
}
if (keyval == GDK_KEY_KP_Enter || keyval == GDK_KEY_Return || keyval == GDK_KEY_ISO_Enter) {
const gint cursor_idx = fsearch_list_view_get_cursor(win->result_view->list_view);
gtk_widget_grab_focus(GTK_WIDGET(win->result_view->list_view));
fsearch_list_view_set_cursor(win->result_view->list_view, cursor_idx);
GActionGroup *group = G_ACTION_GROUP(win);
GAction *action = g_action_map_lookup_action(G_ACTION_MAP(group), "open");
if (!action)
return FALSE;
g_simple_action_set_enabled(G_SIMPLE_ACTION(action), true);
g_action_group_activate_action(group, "open", NULL);
return TRUE;
}
return FALSE;
}

Expand Down

0 comments on commit 847a545

Please sign in to comment.