anjuta r4784 - in trunk: . plugins/search



Author: sgranjoux
Date: Sun Feb 22 16:28:53 2009
New Revision: 4784
URL: http://svn.gnome.org/viewvc/anjuta?rev=4784&view=rev

Log:
	* plugins/search/search-replace.c,
	plugins/search/search-replace_backend.c:
	Backward search go back one character at a time
	Fix an error comparing characters with bytes position


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

Modified: trunk/plugins/search/search-replace.c
==============================================================================
--- trunk/plugins/search/search-replace.c	(original)
+++ trunk/plugins/search/search-replace.c	Sun Feb 22 16:28:53 2009
@@ -382,10 +382,10 @@
 			while (interactive || 
 				NULL != (mi = get_next_match(fb, s->range.direction, &(s->expr))))
 			{
-				if ((s->range.direction == SD_BACKWARD) && (mi->pos < se->end_pos))
+				if ((s->range.direction == SD_BACKWARD) && (mi->pos < end_sel))
 						break; 
-				if ((s->range.direction != SD_BACKWARD) && ((se->end_pos != -1) &&
-					(mi->pos+mi->len > se->end_pos)))
+				if ((s->range.direction != SD_BACKWARD) && ((end_sel != 0) &&
+					(mi->pos+mi->len > end_sel)))
 						break; 
 				nb_results++; 
 				if (nb_results > sr->search.expr.actions_max)

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 22 16:28:53 2009
@@ -457,11 +457,11 @@
 	int len = strlen(s->search_str);
 	gint (*compare)(const gchar *, const gchar *, gsize) =
 		s->match_case ? strncmp : g_ascii_strncasecmp;
-	gchar *p = g_utf8_offset_to_pointer (fb->buf, fb->pos);
+	gchar *p = fb->buf + fb->pos;
 	
 	if (direction == SD_BACKWARD)
 	{
-		for (p -= len; p >= fb->buf; --p)
+		for (; p >= fb->buf; --p)
 			if (!compare(p, s->search_str, len) &&
 				extra_match(p == fb->buf, p, p + len, s))
 				return match_info(fb, p, p + len, direction);
@@ -521,7 +521,7 @@
 	
 	if (direction == SD_BACKWARD)
 	{
-		search_buf = normalize(fb->buf, current - fb->buf, s->match_case);
+		search_buf = normalize(fb->buf, current + strlen (s->search_str) - 1 - fb->buf, s->match_case);
 		if (search_buf)
 		{
 			p = search_buf + strlen(search_buf);



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