SF.net SVN: geany: [1057] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Thu Dec 7 15:13:50 UTC 2006


Revision: 1057
          http://svn.sourceforge.net/geany/?rev=1057&view=rev
Author:   eht16
Date:     2006-12-07 07:13:49 -0800 (Thu, 07 Dec 2006)

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

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/document.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-12-06 20:44:32 UTC (rev 1056)
+++ trunk/ChangeLog	2006-12-07 15:13:49 UTC (rev 1057)
@@ -1,7 +1,18 @@
+2006-12-07  Enrico Tröger  <enrico.troeger at 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 at uvena.de>
 
  * 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 at uvena.de>

Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c	2006-12-06 20:44:32 UTC (rev 1056)
+++ trunk/src/document.c	2006-12-07 15:13:49 UTC (rev 1057)
@@ -1276,14 +1276,24 @@
 }
 
 
-/* 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)
 {
-	if (! type || idx < 0) return;
-	if (type->id > GEANY_MAX_FILE_TYPES) return;
+	if (type == NULL ||
+		! 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);
 	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);
 	type->style_func_ptr(doc_list[idx].sci);
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list