Create new tm file object when changing the filetype of a document to avoid a confused tagmanager.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1057 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2006-12-07 15:13:49 +00:00
parent c461da68f1
commit 46dc43f0df
2 changed files with 25 additions and 4 deletions

View File

@ -1,7 +1,18 @@
2006-12-07 Enrico Tröger <enrico.troeger@uvena.de>
* src/document.c: Create new tm file object when changing the filetype
of a document to avoid a confused tagmanager.
2006-12-06 Enrico Tröger <enrico.troeger@uvena.de> 2006-12-06 Enrico Tröger <enrico.troeger@uvena.de>
* src/sci_cb.c: Don't insert extra indentation in Python files after a * src/sci_cb.c: Don't insert extra indentation in Python files after a
colon if the line is a comment. colon if the line is a comment (closes #1609761).
* src/about.c, src/build.c, src/callbacks.c, src/document.c,
src/encodings.c, src/gb.c, src/keyfile.c, src/prefs.c, src/sci_cb.c,
src/search.c, src/symbols.c, src/ui_utils.c, src/utils.c,
src/utils.h: Removed utils_str_equal() and use g_str_equal() from
GLib because it does exactly the same.
2006-12-05 Enrico Tröger <enrico.troeger@uvena.de> 2006-12-05 Enrico Tröger <enrico.troeger@uvena.de>

View File

@ -1276,14 +1276,24 @@ static GString *get_project_typenames()
} }
/* sets the filetype of the the document (sets syntax highlighting and tagging) */ /* sets the filetype of the document (sets syntax highlighting and tagging) */
void document_set_filetype(gint idx, filetype *type) void document_set_filetype(gint idx, filetype *type)
{ {
if (! type || idx < 0) return; if (type == NULL ||
if (type->id > GEANY_MAX_FILE_TYPES) return; ! DOC_IDX_VALID(idx) ||
doc_list[idx].file_type == type)
return;
geany_debug("%s : %s (%s)", doc_list[idx].file_name, type->name, doc_list[idx].encoding); geany_debug("%s : %s (%s)", doc_list[idx].file_name, type->name, doc_list[idx].encoding);
doc_list[idx].file_type = type; doc_list[idx].file_type = type;
// delete tm file object to force creation of a new one
if (doc_list[idx].tm_file != NULL)
{
tm_workspace_remove_object(doc_list[idx].tm_file, TRUE);
doc_list[idx].tm_file = NULL;
}
document_update_tag_list(idx, TRUE); document_update_tag_list(idx, TRUE);
type->style_func_ptr(doc_list[idx].sci); type->style_func_ptr(doc_list[idx].sci);