SF.net SVN: geany:[3629] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Mon Mar 16 13:43:12 UTC 2009


Revision: 3629
          http://geany.svn.sourceforge.net/geany/?rev=3629&view=rev
Author:   eht16
Date:     2009-03-16 13:43:12 +0000 (Mon, 16 Mar 2009)

Log Message:
-----------
When using Find All in the Find dialog (in Session and Document), display the right amount of matches.
Fix the display of the matches once per line (I broke the original patch).

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-03-15 07:50:05 UTC (rev 3628)
+++ trunk/ChangeLog	2009-03-16 13:43:12 UTC (rev 3629)
@@ -1,3 +1,12 @@
+2009-03-16  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
+
+ * src/search.c:
+   When using Find All in the Find dialog (in Session and Document),
+   display the right amount of matches.
+   Fix the display of the matches once per line (I broke the original
+   patch).
+
+
 2009-03-15  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
 
  * src/socket.c:

Modified: trunk/src/search.c
===================================================================
--- trunk/src/search.c	2009-03-15 07:50:05 UTC (rev 3628)
+++ trunk/src/search.c	2009-03-16 13:43:12 UTC (rev 3629)
@@ -1592,6 +1592,7 @@
 	gchar *buffer, *short_file_name;
 	struct TextToFind ttf;
 	gint count = 0;
+	gint prev_line = -1;
 
 	g_return_val_if_fail(doc != NULL, 0);
 
@@ -1603,7 +1604,6 @@
 	while (1)
 	{
 		gint pos, line, start, find_len;
-		gint prev_line = -1;
 
 		pos = sci_find_text(doc->editor->sci, flags, &ttf);
 		if (pos == -1)
@@ -1634,7 +1634,7 @@
 void search_find_usage(const gchar *search_text, gint flags, gboolean in_session)
 {
 	GeanyDocument *doc;
-	gboolean found = FALSE;
+	gint count = 0;
 
 	doc = document_get_current();
 	g_return_if_fail(doc != NULL);
@@ -1650,7 +1650,7 @@
 
 	if (! in_session)
 	{	/* use current document */
-		found = (find_document_usage(doc, search_text, flags) > 0);
+		count = find_document_usage(doc, search_text, flags);
 	}
 	else
 	{
@@ -1658,20 +1658,19 @@
 		for (i = 0; i < documents_array->len; i++)
 		{
 			if (documents[i]->is_valid)
-				if (find_document_usage(documents[i], search_text, flags) > 0)
-					found = TRUE;
+			{
+				count += find_document_usage(documents[i], search_text, flags);
+			}
 		}
 	}
 
-	if (! found) /* no matches were found */
+	if (count == 0) /* no matches were found */
 	{
 		ui_set_statusbar(FALSE, _("No matches found for \"%s\"."), search_text);
 		msgwin_msg_add(COLOR_BLUE, -1, NULL, _("No matches found for \"%s\"."), search_text);
 	}
 	else
 	{
-		gint count = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(msgwindow.store_msg), NULL);
-
 		ui_set_statusbar(FALSE, ngettext(
 			"Found %d match for \"%s\".", "Found %d matches for \"%s\".", count),
 			count, search_text);


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