CVS: sylpheed-claws/src/gtk quicksearch.c,1.1.2.37.2.1,1.1.2.37.2.2

Colin Leroy <[email protected]>
Newsgroups gmane.mail.sylpheed.claws.cvs
Message-ID <[email protected]>
Update of /cvsroot/sylpheed-claws/sylpheed-claws/src/gtk
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3609/src/gtk

Modified Files:
      Tag: stable_2_1
	quicksearch.c 
Log Message:
2006-04-23 [colin]	2.1.1cvs7-stable

	* src/gtk/quicksearch.c
		From 2.1.1cvs26+27
		Fix replacing in quicksearch, and fix inserting
		in the middle of the string. (introduced at 
		2.1.0cvs6-stable)

Index: quicksearch.c
===================================================================
RCS file: /cvsroot/sylpheed-claws/sylpheed-claws/src/gtk/quicksearch.c,v
retrieving revision 1.1.2.37.2.1
retrieving revision 1.1.2.37.2.2
diff -u -r1.1.2.37.2.1 -r1.1.2.37.2.2
--- quicksearch.c	9 Apr 2006 15:38:35 -0000	1.1.2.37.2.1
+++ quicksearch.c	23 Apr 2006 14:47:50 -0000	1.1.2.37.2.2
@@ -845,6 +845,16 @@
 	char key[7] = "";
 	guint char_len = 0;
 
+	if (gtk_editable_get_selection_bounds(GTK_EDITABLE(entry), NULL, NULL)) {
+		/* remove selection */
+		gtk_editable_delete_selection(GTK_EDITABLE(entry));
+		curpos = gtk_editable_get_position(GTK_EDITABLE(entry));
+		/* refresh string */
+		g_free(str);
+		str = g_strdup(gtk_entry_get_text(entry));
+		begin = str;
+	}
+
 	if (!(c = gdk_keyval_to_unicode(val))) {
 		g_free(str);
 		return;
@@ -854,7 +864,9 @@
 		return;
 	key[char_len] = '\0';
 	if (curpos < g_utf8_strlen(str, -1)) {
-		end = g_utf8_offset_to_pointer(str, curpos+1);
+		gchar *stop = g_utf8_offset_to_pointer(begin, curpos);
+		end = g_strdup(g_utf8_offset_to_pointer(str, curpos));
+		*stop = '\0';
 		new = g_strdup_printf("%s%s%s", begin, key, end);
 		gtk_entry_set_text(entry, new);
 		g_free(end);



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.