anjuta r4714 - in trunk: . plugins/message-view plugins/search



Author: sgranjoux
Date: Sun Feb  8 21:34:56 2009
New Revision: 4714
URL: http://svn.gnome.org/viewvc/anjuta?rev=4714&view=rev

Log:
	* plugins/search/search-replace.c,
	plugins/search/search-replace_backend.c:
	Fix #564942 â display project-relative path in search results pane
	Fix #565015 â duplicate matches in search results pane

	* plugins/message-view/message-view.c:
	Fix #539580 â Uncorrect pass search result to


Modified:
   trunk/ChangeLog
   trunk/plugins/message-view/message-view.c
   trunk/plugins/search/search-replace.c
   trunk/plugins/search/search-replace_backend.c

Modified: trunk/plugins/message-view/message-view.c
==============================================================================
--- trunk/plugins/message-view/message-view.c	(original)
+++ trunk/plugins/message-view/message-view.c	Sun Feb  8 21:34:56 2009
@@ -1323,15 +1323,6 @@
 	/* Check if message contains newlines */
 	for (cur_char = 0; cur_char < len; cur_char++)
 	{		
-		/* Replace "\\\n" with " " */
-		if (message[cur_char] == '\\' && cur_char < len - 1 &&
-			message[cur_char+1] == '\n')
-		{
-			add_char(&view->privat->line_buffer, ' ');
-			cur_char++;
-			continue;
-		}
-
 		/* Is newline => print line */
 		if (message[cur_char] != '\n')
 		{

Modified: trunk/plugins/search/search-replace.c
==============================================================================
--- trunk/plugins/search/search-replace.c	(original)
+++ trunk/plugins/search/search-replace.c	Sun Feb  8 21:34:56 2009
@@ -652,11 +652,37 @@
 	gchar *match_line = file_match_line_from_pos(fb, mi->pos);
 	int line = mi->line;
 	gchar *buf;
-	gchar *path;
+	gchar *path = NULL;
 	
 	if (se->type == SE_FILE)
 		++line;
-	path = g_file_get_path (fb->file);
+	if (fb->file != NULL)
+	{
+		gchar *dir_uri = NULL;	
+		
+		anjuta_shell_get (ANJUTA_PLUGIN(sr->docman)->shell,
+							  "project_root_uri", G_TYPE_STRING,
+							  &dir_uri, NULL);
+		if (dir_uri != NULL)
+		{
+			GFile *root_file = g_file_new_for_uri (dir_uri);
+			
+			g_free (dir_uri);
+			path = g_file_get_relative_path (root_file, fb->file);
+			g_object_unref (root_file);
+		}
+		
+		if (path == NULL)
+		{
+			path = g_file_get_path (fb->file);
+		}
+	}
+	else
+	{
+		g_return_if_fail (se->te != NULL);
+		
+		path = g_strdup (ianjuta_document_get_filename (IANJUTA_DOCUMENT (se->te), NULL));
+	}
 	buf = g_strdup_printf ("%s:%d:%s\n", path, line, match_line);
 	g_free (path);
 	g_free(match_line);

Modified: trunk/plugins/search/search-replace_backend.c
==============================================================================
--- trunk/plugins/search/search-replace_backend.c	(original)
+++ trunk/plugins/search/search-replace_backend.c	Sun Feb  8 21:34:56 2009
@@ -602,6 +602,34 @@
 	g_free (data);
 }
 
+/* Remove duplicate entries in the list, the list must be sorted */
+static GList* search_entries_remove_duplicate (GList *entries)
+{
+	GList *node;
+	
+	for (node = g_list_first (entries); (node != NULL) && (node->next != NULL); )
+	{
+		GList *next = g_list_next (node);
+		SearchEntry *se = (SearchEntry *)node->data;
+		SearchEntry *next_se = (SearchEntry *)next->data;
+		
+		if ((se->te == next_se->te) && (search_entry_compare (se, next_se) == 0))
+		{
+			/* Find a duplicate entry , remove it*/
+			
+			search_entry_free (next_se, NULL);
+			entries = g_list_delete_link (entries, next);
+		}
+		else
+		{
+			/* Get next entry */
+			node = g_list_next(node);
+		}
+	}
+	
+	return entries;
+}
+
 /* Create list of search entries */
 GList *
 create_search_entries (Search *s)
@@ -761,7 +789,6 @@
 					entries = g_list_prepend(entries, se);
 				}
 			}
-			entries = g_list_sort(entries, search_entry_compare);
 			g_list_free (editors);
 			break;
 		case SR_FILES:
@@ -801,13 +828,16 @@
 					entries = g_list_prepend(entries, se);
 				}
 				g_list_free(files);
-				entries = g_list_sort(entries, search_entry_compare);
 			}
 			g_free(dir);
 			g_free(dir_uri);
 			break;
 		}
-	}	
+	}
+
+	entries = g_list_sort(entries, search_entry_compare);
+	entries = search_entries_remove_duplicate (entries);
+	
 	return entries;		
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]