Index: libedataserverui/e-name-selector-entry.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/libedataserverui/e-name-selector-entry.h,v
retrieving revision 1.7
diff -u -p -r1.7 e-name-selector-entry.h
--- libedataserverui/e-name-selector-entry.h	31 Aug 2005 04:26:10 -0000	1.7
+++ libedataserverui/e-name-selector-entry.h	27 Sep 2005 10:45:20 -0000
@@ -63,6 +63,8 @@ struct ENameSelectorEntry {
 
 	EDestination        *popup_destination;
 
+	gchar		    *user_entered_text;
+
 	/* TEMPORARY */
 	gpointer             (*contact_editor_func) (EBook *, EContact *, gboolean, gboolean);
 	gpointer             (*contact_list_editor_func) (EBook *, EContact *, gboolean, gboolean);
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 10:45:39 -0000
@@ -87,6 +87,13 @@ e_name_selector_entry_realize (GtkWidget
 static void
 e_name_selector_entry_dispose (GObject *object)
 {
+	ENameSelectorEntry *name_selector_entry = E_NAME_SELECTOR_ENTRY (object);
+
+	if (name_selector_entry->user_entered_text) {
+		g_free (name_selector_entry->user_entered_text);
+		name_selector_entry->user_entered_text = NULL;
+	}
+
 	if (G_OBJECT_CLASS (e_name_selector_entry_parent_class)->dispose)
 		G_OBJECT_CLASS (e_name_selector_entry_parent_class)->dispose (object);
 }
@@ -970,9 +977,9 @@ remove_destination_by_index (ENameSelect
 static gint
 insert_unichar (ENameSelectorEntry *name_selector_entry, gint *pos, gunichar c)
 {
-	const gchar *text;
+	const gchar  *text;
 	gunichar     str_context [4];
-	gchar        buf [7];
+	gchar        buf [7], *user_entered_text;
 	gint         len;
 
 	text = gtk_entry_get_text (GTK_ENTRY (name_selector_entry));
@@ -995,6 +1002,9 @@ insert_unichar (ENameSelectorEntry *name
 		gboolean     at_start = FALSE;
 		gboolean     at_end   = FALSE;
 
+		g_free (name_selector_entry->user_entered_text);
+		name_selector_entry->user_entered_text = NULL;
+
 		if (str_context [1] == ',' || str_context [1] == '\0')
 			return 0;
 
@@ -1040,7 +1050,36 @@ insert_unichar (ENameSelectorEntry *name
 	len = g_unichar_to_utf8 (c, buf);
 	buf [len] = '\0';
 
-	gtk_editable_insert_text (GTK_EDITABLE (name_selector_entry), buf, -1, pos);
+	if (name_selector_entry->user_entered_text) {
+		/* update the characters inserted */
+		user_entered_text = g_strdup (name_selector_entry->user_entered_text);
+		g_free (name_selector_entry->user_entered_text);
+		name_selector_entry->user_entered_text = g_strconcat (user_entered_text, buf, NULL);
+		g_free (user_entered_text);
+	}
+	else {
+		name_selector_entry->user_entered_text =  g_strdup (buf);
+	}
+
+	if (c == '@') {
+		gint         start_del_pos;
+		gint         end_del_pos;
+
+		/* user is trying to enter the email-id, delete the autocompleted name and 
+		 * replace with the actual characters inserted 
+		 */
+		get_range_at_position (buf, *pos, &start_del_pos, &end_del_pos);
+		gtk_editable_delete_text (GTK_EDITABLE (name_selector_entry), 
+					  (*pos+1) - g_utf8_strlen (name_selector_entry->user_entered_text, -1), 
+					  *pos);
+		gtk_editable_insert_text (GTK_EDITABLE (name_selector_entry), 
+					  name_selector_entry->user_entered_text, -1, pos);
+		g_free (name_selector_entry->user_entered_text);
+		name_selector_entry->user_entered_text = NULL;
+	}
+	else {
+		gtk_editable_insert_text (GTK_EDITABLE (name_selector_entry), buf, -1, pos);
+	}
 
 	text = gtk_entry_get_text (GTK_ENTRY (name_selector_entry));
 	len = g_utf8_strlen (text, -1);
@@ -1864,6 +1903,7 @@ e_name_selector_entry_init (ENameSelecto
   /* Completion */
 
   name_selector_entry->email_generator = NULL;
+  name_selector_entry->user_entered_text = NULL;
 
   name_selector_entry->entry_completion = gtk_entry_completion_new ();
   gtk_entry_completion_set_match_func (name_selector_entry->entry_completion,
