[evolution-patches] [addressbook] Patch for Bug 314997: Editing addresses in the composer is buggy



Hi,

In name selector entry while deleting character-by-character when u hit
a comma, entire address is selected and in the next keystroke whole
address is deleted, leaving behind a comma. Fixed this so that comma is
also removed along with the address.

thanks
devashish sharma

Index: libedataserverui/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/libedataserverui/ChangeLog,v
retrieving revision 1.62
diff -u -p -r1.62 ChangeLog
--- libedataserverui/ChangeLog	26 Aug 2005 11:44:47 -0000	1.62
+++ libedataserverui/ChangeLog	27 Sep 2005 06:23:50 -0000
@@ -1,3 +1,12 @@
+2005-09-27  Devashish Sharma <sdevashish novell com>
+
+	* e-name-selector-entry.c (user_delete_text): In name selector entry
+	while deleting character-by-character when u hit a comma, entire
+	address is selected and in the next keystroke whole address is
+	deleted, leaving behind a comma. Fixed this so that comma is also 
+	removed along with the address.
+	Fixes #314997.
+
 2005-08-26  Harish Krishnaswamy  <kharish novell com>
 
 	* e-name-selector-dialog.c: (e_name_selector_dialog_init):
Index: libedataserverui/e-name-selector-entry.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/libedataserverui/e-name-selector-entry.c,v
retrieving revision 1.25
diff -u -p -r1.25 e-name-selector-entry.c
--- libedataserverui/e-name-selector-entry.c	31 Aug 2005 04:26:10 -0000	1.25
+++ libedataserverui/e-name-selector-entry.c	27 Sep 2005 06:29:00 -0000
@@ -1111,15 +1111,22 @@ user_delete_text (ENameSelectorEntry *na
 {
 	const gchar *text;
 	gint         index_start, index_end;
+	gint	     selection_start, selection_end;	
 	gunichar     str_context [2], str_b_context [2];;
 	gint         len;
 	gint         i;
+	gint 	     already_selected = 0;
 
-	if (start_pos == end_pos)
+	if (start_pos == end_pos) 
 		return;
 
 	text = gtk_entry_get_text (GTK_ENTRY (name_selector_entry));
 	len = g_utf8_strlen (text, -1);
+
+	if (gtk_editable_get_selection_bounds(GTK_EDITABLE (name_selector_entry), &selection_start, &selection_end)) 
+		if (g_utf8_get_char (g_utf8_offset_to_pointer (text, selection_end-1)) == ',') 
+			already_selected = 1;
+	
 	get_utf8_string_context (text, start_pos, str_context, 2);
 	get_utf8_string_context (text, end_pos-1, str_b_context, 2);
 
@@ -1142,9 +1149,9 @@ user_delete_text (ENameSelectorEntry *na
 	/* If the user is trying to delete a ','-character, we assume the user 
 	 * wants to remove the entire destination.
 	 */
-	
-	if ((str_b_context [0] == ',' && str_b_context [1] == ' ') || str_b_context [1] == ',') {
-	
+
+	if (((str_b_context [0] == ',' && str_b_context [1] == ' ') || str_b_context [1] == ',') && !already_selected) {
+
 		EDestination *dest = find_destination_at_position (name_selector_entry, end_pos-1);
 	  	const char *email = e_destination_get_email (dest);
 	  	if (email && (strcmp (email, "")!=0)) {
@@ -1153,11 +1160,11 @@ user_delete_text (ENameSelectorEntry *na
 		 	 * Deleting this selection afterwards will leave the destination
 		 	 * empty. */
 	 
-			gint t = (str_b_context [1]==',')?end_pos-1:end_pos-2, b=t;
+			gint t = (str_b_context [1]==',')?end_pos:end_pos-1, b=t;
 			do {
 				t--;
 			} while (t >= 1 && text[t-1] != ',');
-		
+	
 			gtk_editable_select_region (GTK_EDITABLE(name_selector_entry), t, b);
 
 			/* Since this is a special-case, we don't want the rest of this method


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