Kaydet (Commit) dcd06b21 authored tarafından Nick Treleaven's avatar Nick Treleaven

Ensure document_update_tag_list() always shows the empty symbol list

when tags cannot be parsed.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2004 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst fbb8fb5f
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
Prevent prefs dialog being hidden after using the prefs file dialog. Prevent prefs dialog being hidden after using the prefs file dialog.
* src/build.c, src/prefs.c: * src/build.c, src/prefs.c:
Enable build support on Windows. Enable build support on Windows.
* src/document.c:
Ensure document_update_tag_list() always shows the empty symbol list
when tags cannot be parsed.
2007-11-01 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> 2007-11-01 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
......
...@@ -1724,13 +1724,14 @@ void document_set_font(gint idx, const gchar *font_name, gint size) ...@@ -1724,13 +1724,14 @@ void document_set_font(gint idx, const gchar *font_name, gint size)
void document_update_tag_list(gint idx, gboolean update) void document_update_tag_list(gint idx, gboolean update)
{ {
/* We must call treeviews_update_tag_list() before returning,
* to ensure that the symbol list is always updated properly (e.g.
* when creating a new document with a partial filename set. */
gboolean success = FALSE; gboolean success = FALSE;
if (app->tm_workspace == NULL)
return;
// if the filetype doesn't have a tag parser or it is a new file // if the filetype doesn't have a tag parser or it is a new file
if (idx == -1 || doc_list[idx].file_type == NULL || if (idx == -1 || doc_list[idx].file_type == NULL ||
app->tm_workspace == NULL ||
! filetype_has_tags(doc_list[idx].file_type) || ! doc_list[idx].file_name) ! filetype_has_tags(doc_list[idx].file_type) || ! doc_list[idx].file_name)
{ {
// set the default (empty) tag list // set the default (empty) tag list
...@@ -1740,38 +1741,32 @@ void document_update_tag_list(gint idx, gboolean update) ...@@ -1740,38 +1741,32 @@ void document_update_tag_list(gint idx, gboolean update)
if (doc_list[idx].tm_file == NULL) if (doc_list[idx].tm_file == NULL)
{ {
#ifdef GEANY_OS_WIN32
doc_list[idx].tm_file = tm_source_file_new(
doc_list[idx].file_name, FALSE, doc_list[idx].file_type->name);
#else
gchar *locale_filename = utils_get_locale_from_utf8(doc_list[idx].file_name); gchar *locale_filename = utils_get_locale_from_utf8(doc_list[idx].file_name);
doc_list[idx].tm_file = tm_source_file_new( doc_list[idx].tm_file = tm_source_file_new(
locale_filename, FALSE, doc_list[idx].file_type->name); locale_filename, FALSE, doc_list[idx].file_type->name);
g_free(locale_filename); g_free(locale_filename);
#endif
if (doc_list[idx].tm_file) if (doc_list[idx].tm_file)
{ {
if (!tm_workspace_add_object(doc_list[idx].tm_file)) if (!tm_workspace_add_object(doc_list[idx].tm_file))
{ {
tm_work_object_free(doc_list[idx].tm_file); tm_work_object_free(doc_list[idx].tm_file);
doc_list[idx].tm_file = NULL; doc_list[idx].tm_file = NULL;
return;
} }
if (update) else
tm_source_file_update(doc_list[idx].tm_file, TRUE, FALSE, TRUE); {
success = TRUE; if (update)
tm_source_file_update(doc_list[idx].tm_file, TRUE, FALSE, TRUE);
success = TRUE;
}
} }
} }
else else
{ {
if (tm_source_file_update(doc_list[idx].tm_file, TRUE, FALSE, TRUE)) success = tm_source_file_update(doc_list[idx].tm_file, TRUE, FALSE, TRUE);
{ if (! success)
success = TRUE;
}
else
{
geany_debug("tag list updating failed"); geany_debug("tag list updating failed");
}
} }
treeviews_update_tag_list(idx, success); treeviews_update_tag_list(idx, success);
} }
......
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