/pidgin/main: 33197cba2b9d: Better handling of parenthesized sea...

Elliott Sales de Andrade qulogic at pidgin.im
Tue Jul 24 04:03:42 EDT 2012


Changeset: 33197cba2b9dc08dfa790722d7a7531cc37ccc8a
Author:	 Elliott Sales de Andrade <qulogic at pidgin.im>
Date:	 2012-07-21 03:16 -0400
Branch:	 default
URL: http://hg.pidgin.im/pidgin/main/rev/33197cba2b9d

Description:

Better handling of parenthesized searches.

Previously, the entire matched text was highlighted (match 0), and
all parenthesized matches were also highlighted, except for the
first (match 1). However, highlighting the first match hid any of
the parentheized matches.

Now, if there are parenthesized matches, those are the only ones
highlighted, instead of the whole thing.

diffstat:

 pidgin/gtkdebug.c |  13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diffs (30 lines):

diff --git a/pidgin/gtkdebug.c b/pidgin/gtkdebug.c
--- a/pidgin/gtkdebug.c
+++ b/pidgin/gtkdebug.c
@@ -234,18 +234,21 @@
 		 */
 		do
 		{
-			gint m;
+			gint m, count;
 			gint start_pos, end_pos;
 			GtkTextIter ms, me;
 
 			if (!g_match_info_matches(match_info))
 				break;
 
-			for (m = 0; m < g_match_info_get_match_count(match_info); m++)
+			count = g_match_info_get_match_count(match_info);
+			if (count == 1)
+				m = 0;
+			else
+				m = 1;
+
+			for (; m < count; m++)
 			{
-				if (m == 1)
-					continue;
-
 				g_match_info_fetch_pos(match_info, m, &start_pos, &end_pos);
 
 				if (end_pos == -1)



More information about the Commits mailing list