-
-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
First step at enabling searching in index page #677
base: develop
Are you sure you want to change the base?
Conversation
gboolean search_equal_func_index(GtkTreeModel* model, gint column, const gchar* key, GtkTreeIter* iter, | ||
gpointer search_data) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reimplement the search equal function so that it will also compared with collapsed entries
@@ -125,6 +128,82 @@ static gboolean search_current_index(GtkTreeModel* model, GtkTreePath* UNUSED(pa | |||
return FALSE; | |||
} | |||
|
|||
static bool find_substring(const char* source_str, const char* search_str) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Find the search_str
in source_str
, as opposed to only match from the beginning of source_str
@@ -1203,6 +1203,8 @@ bool sc_toggle_index(girara_session_t* session, girara_argument_t* UNUSED(argume | |||
g_object_set(G_OBJECT(renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL); | |||
g_object_set(G_OBJECT(gtk_tree_view_get_column(GTK_TREE_VIEW(treeview), 0)), "expand", TRUE, NULL); | |||
gtk_tree_view_column_set_alignment(gtk_tree_view_get_column(GTK_TREE_VIEW(treeview), 1), 1.0f); | |||
gtk_tree_view_set_search_equal_func(GTK_TREE_VIEW(treeview), search_equal_func_index, treeview, NULL); | |||
gtk_tree_view_set_enable_search(GTK_TREE_VIEW(treeview), FALSE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disable interactive search by default, so that all the hotkeys (j, k, q...) are not consummed by the search function
This PR is a proof of concept for enabling search in index page. It only use the native functionality of
GTK
.The behavior:
C-f
(the default shortcut ofGTK
) to have the interactive search window appearPartly fixes #565