+2005-09-30 Devashish Sharma <sdevashish@novell.com>
+
+ * e-name-selector-entry.c (user_delete_text): In name selector entry
+ while deleting character-by-character when you 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):
{
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;
+ gboolean already_selected = FALSE;
- 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 = TRUE;
+
get_utf8_string_context (text, start_pos, str_context, 2);
get_utf8_string_context (text, end_pos-1, str_b_context, 2);
/* 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)) {
* 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