Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Tue, 04 Feb 2025 23:41:42 UTC Commit: 3f94f5e88262fea5f0c1b1ef72c27bbeb86a4f0a https://github.com/geany/geany/commit/3f94f5e88262fea5f0c1b1ef72c27bbeb86a4f...
Log Message: ----------- prefs: Edit the correct keybinding when there is a filter
When the keybinding list is filtered and the keybinding cell is edited, store the value in the correct row instead of the one corresponding to the Nth visible one, but in the unfiltered tree.
E.g., if filtering with `redo` it shows only 1 item, and editing it should change that one (Edit/Redo), not the first of the unfiltered list (File/New).
Related-to: #4192
Modified Paths: -------------- src/prefs.c
Modified: src/prefs.c 10 lines changed, 7 insertions(+), 3 deletions(-) =================================================================== @@ -1405,13 +1405,17 @@ static void kb_cell_edited_cb(GtkCellRendererText *cellrenderertext, { if (path != NULL && new_text != NULL) { + GtkTreeModel *filter_model = gtk_tree_view_get_model(kbdata->tree); GtkTreeIter iter; + GtkTreeIter child_iter;
- gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(kbdata->store), &iter, path); - if (gtk_tree_model_iter_has_child(GTK_TREE_MODEL(kbdata->store), &iter)) + gtk_tree_model_get_iter_from_string(filter_model, &iter, path); + if (gtk_tree_model_iter_has_child(filter_model, &iter)) return; /* ignore group items */
- kb_change_iter_shortcut(kbdata, &iter, new_text); + gtk_tree_model_filter_convert_iter_to_child_iter(GTK_TREE_MODEL_FILTER(filter_model), + &child_iter, &iter); + kb_change_iter_shortcut(kbdata, &child_iter, new_text); } }
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).