Kaydet (Commit) ef0b0599 authored tarafından Colomban Wendling's avatar Colomban Wendling

Rewrite symbols tree updating code

Old implementation was not really fitting the updating needs and had a
bug making symbols disappear if they haven't changed but their parent
did (e.g. when a C++ constructor's signature changed).

New implementation does:
1) walk old tree, updating or removing rows;
2) add remaining tags.

It walks less than (new_tags + old_tags + new_tags) in the worst case,
thanks to some hash table-based caching;  and also gets rid of the
"valid" column in the symbols tree, saving a few bytes in memory.

Finally, there is a ~7% performance gain (from 21 to 18ms) upon common
tree updates, sometimes more.
üst f9944273
......@@ -216,7 +216,7 @@ void sidebar_update_tag_list(GeanyDocument *doc, gboolean update)
if (doc->priv->tag_tree == NULL)
{
doc->priv->tag_store = gtk_tree_store_new(
SYMBOLS_N_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, TM_TYPE_TAG, G_TYPE_STRING, G_TYPE_BOOLEAN);
SYMBOLS_N_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, TM_TYPE_TAG, G_TYPE_STRING);
doc->priv->tag_tree = gtk_tree_view_new();
prepare_taglist(doc->priv->tag_tree, doc->priv->tag_store);
gtk_widget_show(doc->priv->tag_tree);
......
......@@ -41,7 +41,6 @@ enum
SYMBOLS_COLUMN_NAME,
SYMBOLS_COLUMN_TAG,
SYMBOLS_COLUMN_TOOLTIP,
SYMBOLS_COLUMN_VALID,
SYMBOLS_N_COLUMNS
};
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment