SF.net SVN: geany: [1095] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Thu Dec 14 12:54:37 UTC 2006


Revision: 1095
          http://svn.sourceforge.net/geany/?rev=1095&view=rev
Author:   ntrel
Date:     2006-12-14 04:54:36 -0800 (Thu, 14 Dec 2006)

Log Message:
-----------
Fix updating the symbol list when a file is saved.
Update C-like typedef keywords when reloading a file.

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-12-13 23:05:24 UTC (rev 1094)
+++ trunk/ChangeLog	2006-12-14 12:54:36 UTC (rev 1095)
@@ -1,3 +1,10 @@
+2006-12-14  Nick Treleaven  <nick.treleaven at btinternet.com>
+
+ * src/document.c:
+   Fix updating the symbol list when a file is saved.
+   Update C-like typedef keywords when reloading a file.
+
+
 2006-12-13  Frank Lanitz  <frank at frank.uvena.de>
 
  * THANKS: Small update of contact data and small fix of translated 

Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c	2006-12-13 23:05:24 UTC (rev 1094)
+++ trunk/src/document.c	2006-12-14 12:54:36 UTC (rev 1095)
@@ -551,6 +551,7 @@
 	gchar *locale_filename = NULL;
 	GError *err = NULL;
 	gchar *data = NULL;
+	filetype *use_ft;
 
 	//struct timeval tv, tv1;
 	//struct timezone tz;
@@ -692,23 +693,22 @@
 
 	if (! reload)
 	{
-		filetype *use_ft = (ft != NULL) ? ft : filetypes_get_from_filename(idx);
-
 		doc_list[idx].readonly = readonly;
 		sci_set_readonly(doc_list[idx].sci, readonly);
 
-		document_set_filetype(idx, use_ft);	// also sets taglist
-		build_menu_update(idx);
-
 		// "the" SCI signal (connect after initial setup(i.e. adding text))
 		g_signal_connect((GtkWidget*) doc_list[idx].sci, "sci-notify",
 					G_CALLBACK(on_editor_notification), GINT_TO_POINTER(idx));
+
+		use_ft = (ft != NULL) ? ft : filetypes_get_from_filename(idx);
 	}
 	else
 	{	// reloading
-		document_update_tag_list(idx, TRUE);
 		document_undo_clear(idx);
+		use_ft = ft;
 	}
+	// update taglist, typedef keywords and build menu if necessary
+	document_set_filetype(idx, use_ft);
 
 	document_set_text_changed(idx);	// also updates tab state
 	ui_document_show_hide(idx);	// update the document menu
@@ -1306,23 +1306,26 @@
 /* sets the filetype of the document (sets syntax highlighting and tagging) */
 void document_set_filetype(gint idx, filetype *type)
 {
-	if (type == NULL ||
-		! DOC_IDX_VALID(idx) ||
-		doc_list[idx].file_type == type)
+	if (type == NULL || ! DOC_IDX_VALID(idx))
 		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)
+	if (doc_list[idx].file_type != type)	// filetype has changed
 	{
-		tm_workspace_remove_object(doc_list[idx].tm_file, TRUE);
-		doc_list[idx].tm_file = NULL;
+		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;
+		}
+		build_menu_update(idx);
+		type->style_func_ptr(doc_list[idx].sci);	// set new styles
 	}
 
 	document_update_tag_list(idx, TRUE);
-	type->style_func_ptr(doc_list[idx].sci);
 
 	// For C/C++/Java files, get list of typedefs for colourising
 	if (sci_get_lexer(doc_list[idx].sci) == SCLEX_CPP)
@@ -1346,7 +1349,6 @@
 		}
 	}
 	sci_colourise(doc_list[idx].sci, 0, -1);
-	build_menu_update(idx);
 }
 
 


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