[Github-comments] [geany/geany] Filter for symbol tree - improved version (PR #3055)

Enrico Tröger notifications at xxxxx
Sun Jan 2 15:50:07 UTC 2022


@eht16 requested changes on this pull request.



>  		sidebar_select_openfiles_item(doc);
 		ui_save_buttons_toggle(doc->changed);
 		ui_set_window_title(doc);
 		ui_update_statusbar(doc, -1);
 		ui_update_popup_reundo_items(doc);
 		ui_document_show_hide(doc); /* update the document menu */
 		build_menu_update(doc);
-		sidebar_update_tag_list(doc, FALSE);
+		if (g_strcmp0(entry_text, doc->priv->tag_filter) != 0)
+			gtk_entry_set_text(filter_entry, doc->priv->tag_filter);

If the text of the filter entry is changed because it differs from the document's filter, `gtk_entry_set_text()` will eventually emit the "changed" signal and in its handler `sidebar_update_tag_list()` is called and then below it is called again.
So if the new or previous document have filters set and they don't equal, we update the symbol list twice on each notebook page change.

Maybe we could just make the symbol list update below dependent of the if condition above?

>  
 	g_return_val_if_fail(doc, NULL);
 
 	if (! doc->tm_file || ! doc->tm_file->tags_array)
 		return NULL;
 
+	tf_strv = g_strsplit_set(doc->priv->tag_filter, " ", -1);

This means we can have multiple filters seperarted by space which are then combined (AND)?
At least it feels so while testing. This is cool but might not be too obvious to the user. Maybe document this in the widget's tooltip?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/3055#pullrequestreview-842405701
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany/pull/3055/review/842405701 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20220102/805b95c4/attachment-0001.htm>


More information about the Github-comments mailing list