Commit 28c2e213 authored by Sebastien Granjoux's avatar Sebastien Granjoux

Fix #564942 – display project-relative path in search results pane Fix

	* 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

svn path=/trunk/; revision=4714
parent b275534e
2009-02-08 Sébastien Granjoux <seb.sfo@free.fr>
* 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
2009-02-08 Sébastien Granjoux <seb.sfo@free.fr>
* www/htdocs/downloads.php:
......@@ -1323,15 +1323,6 @@ imessage_view_buffer_append (IAnjutaMessageView * message_view,
/* 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')
{
......
......@@ -652,11 +652,37 @@ write_message_pane(IAnjutaMessageView* view, FileBuffer *fb, SearchEntry *se,
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;
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);
......
......@@ -602,6 +602,34 @@ static void search_entry_free (gpointer data, gpointer user_data)
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 @@ create_search_entries (Search *s)
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 @@ create_search_entries (Search *s)
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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment