SF.net SVN: geany: [421] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Wed Jun 7 21:24:27 UTC 2006


Revision: 421
Author:   ntrel
Date:     2006-06-07 14:24:15 -0700 (Wed, 07 Jun 2006)
ViewCVS:  http://svn.sourceforge.net/geany/?rev=421&view=rev

Log Message:
-----------
Fix bug with Go to tag defn/decl when the filename is a link (TagManager dereferences linked filenames)

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/callbacks.c
    trunk/src/document.c
    trunk/src/document.h
    trunk/src/utils.c
    trunk/src/utils.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-06-07 19:25:20 UTC (rev 420)
+++ trunk/ChangeLog	2006-06-07 21:24:15 UTC (rev 421)
@@ -5,6 +5,9 @@
  * src/callbacks.c, src/sciwrappers.c, src/sciwrappers.h:
    Use the character position under the mouse click for Go to
    definition/declaration and for overridden middle click text paste.
+ * src/utils.c, src/utils.h, src/callbacks.c, src/document.c,
+   src/document.h: Fix bug with Go to tag defn/decl when the filename
+                   is a link (TagManager dereferences linked filenames)
 
 
 2006-06-06  Enrico Troeger  <enrico.troeger at uvena.de>

Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c	2006-06-07 19:25:20 UTC (rev 420)
+++ trunk/src/callbacks.c	2006-06-07 21:24:15 UTC (rev 421)
@@ -1318,6 +1318,7 @@
 				{
 					if (! utils_goto_workspace_tag(
 							TM_TAG(tags->pdata[i])->atts.entry.file->work_object.file_name,
+							TRUE,
 							TM_TAG(tags->pdata[i])->atts.entry.line))
 					{
 						utils_beep();
@@ -1372,7 +1373,7 @@
 				gtk_tree_model_get(model, &iter, 0, &line, 1, &file, -1);
 				if (file && strlen (file) > 0)
 				{
-					utils_goto_workspace_tag(file, line);
+					utils_goto_workspace_tag(file, FALSE, line);
 				}
 				g_free(file);
 			}

Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c	2006-06-07 19:25:20 UTC (rev 420)
+++ trunk/src/document.c	2006-06-07 21:24:15 UTC (rev 421)
@@ -54,8 +54,10 @@
 
 
 
-/* returns the index of the notebook page which has the given filename */
-gint document_find_by_filename(const gchar *filename)
+/* returns the index of the notebook page which has the given filename
+ * is_tm_filename is needed when passing TagManager filenames because they are
+ * dereferenced, and would not match the link filename. */
+gint document_find_by_filename(const gchar *filename, gboolean is_tm_filename)
 {
 	guint i;
 
@@ -63,11 +65,13 @@
 
 	for(i = 0; i < GEANY_MAX_OPEN_FILES; i++)
 	{
+		gchar *dl_fname = (is_tm_filename) ? doc_list[i].tm_file->file_name :
+			doc_list[i].file_name;
 #ifdef GEANY_WIN32
 		// ignore the case of filenames and paths under WIN32, causes errors if not
-		if (doc_list[i].file_name && ! strcasecmp(doc_list[i].file_name, filename)) return i;
+		if (dl_fname && ! strcasecmp(dl_fname, filename)) return i;
 #else
-		if (doc_list[i].file_name && utils_strcmp(doc_list[i].file_name, filename)) return i;
+		if (dl_fname && utils_strcmp(dl_fname, filename)) return i;
 #endif
 	}
 	return -1;
@@ -439,7 +443,7 @@
 		}
 
 		// if file is already open, switch to it and go
-		idx = document_find_by_filename(utf8_filename);
+		idx = document_find_by_filename(utf8_filename, FALSE);
 		if (idx >= 0)
 		{
 			gtk_notebook_set_current_page(GTK_NOTEBOOK(app->notebook),

Modified: trunk/src/document.h
===================================================================
--- trunk/src/document.h	2006-06-07 19:25:20 UTC (rev 420)
+++ trunk/src/document.h	2006-06-07 21:24:15 UTC (rev 421)
@@ -26,7 +26,7 @@
 
 
 /* returns the index of the notebook page which has the given filename */
-gint document_find_by_filename(const gchar*);
+gint document_find_by_filename(const gchar*, gboolean is_tm_filename);
 
 
 /* returns the index of the notebook page which has sci */

Modified: trunk/src/utils.c
===================================================================
--- trunk/src/utils.c	2006-06-07 19:25:20 UTC (rev 420)
+++ trunk/src/utils.c	2006-06-07 21:24:15 UTC (rev 421)
@@ -457,10 +457,10 @@
 }
 
 
-gboolean utils_goto_workspace_tag(const gchar *file, gint line)
+gboolean utils_goto_workspace_tag(const gchar *file, gboolean is_tm_filename, gint line)
 {
 	gint page_num;
-	gint file_idx = document_find_by_filename(file);
+	gint file_idx = document_find_by_filename(file, is_tm_filename);
 	gboolean ret;
 
 	if (file_idx < 0) return FALSE;

Modified: trunk/src/utils.h
===================================================================
--- trunk/src/utils.h	2006-06-07 19:25:20 UTC (rev 420)
+++ trunk/src/utils.h	2006-06-07 21:24:15 UTC (rev 421)
@@ -59,7 +59,7 @@
 
 gint utils_get_local_tag(gint idx, const gchar *qual_name);
 
-gboolean utils_goto_workspace_tag(const gchar *file, gint line);
+gboolean utils_goto_workspace_tag(const gchar *file, gboolean is_tm_filename, gint line);
 
 gboolean utils_goto_line(gint idx, gint line);
 


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