Don't update parent WorkObjects when updating one in real-time

Updating the parent may lead to performance issues if an object have
too many parents since they are updated recursively.

Parent objects are still updated when saving the file.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5642 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Colomban Wendling 2011-03-28 20:36:06 +00:00
parent b235ae2f7e
commit 8640d845d0
5 changed files with 18 additions and 11 deletions

View File

@ -1,3 +1,10 @@
2011-03-28 Colomban Wendling <colomban(at)geany(dot)org>
* src/document.c, src/document.h, src/editor.c, src/keybindings.c:
Don't update parent WorkObjects when updating one in real-time. This
should fix some performance issues if a WorkObject has many parents.
2011-03-27 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* src/makefile.win32, src/main.c, src/Makefile.am, configure.ac,

View File

@ -109,7 +109,7 @@ typedef struct
static void document_undo_clear(GeanyDocument *doc);
static void document_redo_add(GeanyDocument *doc, guint type, gpointer data);
static gboolean update_tags_from_buffer(GeanyDocument *doc);
static gboolean update_tags_from_buffer(GeanyDocument *doc, gboolean update_parent);
/* ignore the case of filenames and paths under WIN32, causes errors if not */
@ -771,7 +771,7 @@ GeanyDocument *document_new_file(const gchar *utf8_filename, GeanyFiletype *ft,
ui_set_window_title(doc);
build_menu_update(doc);
document_update_tag_list(doc, FALSE);
document_update_tag_list(doc, FALSE, TRUE);
document_set_text_changed(doc, FALSE);
ui_document_show_hide(doc); /* update the document menu */
@ -2250,7 +2250,7 @@ gint document_replace_all(GeanyDocument *doc, const gchar *find_text, const gcha
}
static gboolean update_tags_from_buffer(GeanyDocument *doc)
static gboolean update_tags_from_buffer(GeanyDocument *doc, gboolean update_parent)
{
gboolean result;
#if 0
@ -2263,14 +2263,14 @@ static gboolean update_tags_from_buffer(GeanyDocument *doc)
/* we copy the whole text into memory instead using a direct char pointer from
* Scintilla because tm_source_file_buffer_update() does modify the string slightly */
sci_get_text(doc->editor->sci, len, text);
result = tm_source_file_buffer_update(doc->tm_file, (guchar*) text, len, TRUE);
result = tm_source_file_buffer_update(doc->tm_file, (guchar*) text, len, update_parent);
g_free(text);
#endif
return result;
}
void document_update_tag_list(GeanyDocument *doc, gboolean update)
void document_update_tag_list(GeanyDocument *doc, gboolean update, gboolean update_parent)
{
/* We must call sidebar_update_tag_list() before returning,
* to ensure that the symbol list is always updated properly (e.g.
@ -2306,14 +2306,14 @@ void document_update_tag_list(GeanyDocument *doc, gboolean update)
else
{
if (update)
update_tags_from_buffer(doc);
update_tags_from_buffer(doc, update_parent);
success = TRUE;
}
}
}
else
{
success = update_tags_from_buffer(doc);
success = update_tags_from_buffer(doc, update_parent);
if (G_UNLIKELY(! success))
geany_debug("tag list updating failed");
}
@ -2449,7 +2449,7 @@ static void document_load_config(GeanyDocument *doc, GeanyFiletype *type,
doc->priv->symbol_list_sort_mode = type->priv->symbol_list_sort_mode;
}
document_update_tag_list(doc, TRUE);
document_update_tag_list(doc, TRUE, TRUE);
/* Update session typename keywords. */
update_type_keywords(doc, type->lang);

View File

@ -229,7 +229,7 @@ gint document_replace_all(GeanyDocument *doc, const gchar *find_text, const gcha
void document_replace_sel(GeanyDocument *doc, const gchar *find_text, const gchar *replace_text, gint flags,
gboolean escaped_chars);
void document_update_tag_list(GeanyDocument *doc, gboolean update);
void document_update_tag_list(GeanyDocument *doc, gboolean update, gboolean update_parent);
void document_set_encoding(GeanyDocument *doc, const gchar *new_encoding);

View File

@ -999,7 +999,7 @@ static gboolean on_document_update_tags_idle(gpointer data)
GeanyDocument *doc = data;
if (!main_status.quitting && DOC_VALID(doc))
document_update_tag_list(doc, TRUE);
document_update_tag_list(doc, TRUE, FALSE);
document_tags_update_pending = FALSE;
return FALSE;

View File

@ -2524,7 +2524,7 @@ static gboolean cb_func_document_action(guint key_id)
ui_document_show_hide(doc);
break;
case GEANY_KEYS_DOCUMENT_RELOADTAGLIST:
document_update_tag_list(doc, TRUE);
document_update_tag_list(doc, TRUE, TRUE);
break;
case GEANY_KEYS_DOCUMENT_FOLDALL:
editor_fold_all(doc->editor);