aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/component
diff options
context:
space:
mode:
authorJon Trowbridge <trow@ximian.com>2001-08-10 03:10:14 +0800
committerJon Trowbridge <trow@src.gnome.org>2001-08-10 03:10:14 +0800
commit6683241eb5b06bbafd20fca9d1fad0fb3ef28676 (patch)
tree9dc46c6146393fee02f0f3a414338c70ae76d942 /addressbook/gui/component
parent416a6768d6e2596fb4c4071dcf0430b886d1dadc (diff)
downloadgsoc2013-evolution-6683241eb5b06bbafd20fca9d1fad0fb3ef28676.tar
gsoc2013-evolution-6683241eb5b06bbafd20fca9d1fad0fb3ef28676.tar.gz
gsoc2013-evolution-6683241eb5b06bbafd20fca9d1fad0fb3ef28676.tar.bz2
gsoc2013-evolution-6683241eb5b06bbafd20fca9d1fad0fb3ef28676.tar.lz
gsoc2013-evolution-6683241eb5b06bbafd20fca9d1fad0fb3ef28676.tar.xz
gsoc2013-evolution-6683241eb5b06bbafd20fca9d1fad0fb3ef28676.tar.zst
gsoc2013-evolution-6683241eb5b06bbafd20fca9d1fad0fb3ef28676.zip
If the last character we inserted was a "magic comma", remember its
2001-08-09 Jon Trowbridge <trow@ximian.com> * gui/component/select-names/e-select-names-text-model.c This change is dedicated to Jacob Berkman. (e_select_names_text_model_insert_length): If the last character we inserted was a "magic comma", remember its position. (e_select_names_text_model_delete): If the last character we inserted was a "magic comma", and if the next thing we do is to hit backspace, delete both the comma and the extra whitespace we added. (e_select_names_text_model_init): Initialize our last magic comma position. svn path=/trunk/; revision=11839
Diffstat (limited to 'addressbook/gui/component')
-rw-r--r--addressbook/gui/component/select-names/e-select-names-text-model.c14
-rw-r--r--addressbook/gui/component/select-names/e-select-names-text-model.h2
2 files changed, 16 insertions, 0 deletions
diff --git a/addressbook/gui/component/select-names/e-select-names-text-model.c b/addressbook/gui/component/select-names/e-select-names-text-model.c
index 2f10516dd1..c6f2b7856b 100644
--- a/addressbook/gui/component/select-names/e-select-names-text-model.c
+++ b/addressbook/gui/component/select-names/e-select-names-text-model.c
@@ -140,6 +140,7 @@ dump_model (ESelectNamesTextModel *text_model)
static void
e_select_names_text_model_init (ESelectNamesTextModel *model)
{
+ model->last_magic_comma_pos = -1;
}
static void
@@ -301,6 +302,8 @@ e_select_names_text_model_insert_length (ETextModel *model, gint pos, const gcha
gint index, start_pos, text_len;
gboolean inside_quote = FALSE;
+ E_SELECT_NAMES_TEXT_MODEL (model)->last_magic_comma_pos = -1;
+
if (out)
fprintf (out, "processing [%c]\n", text[i]);
@@ -387,6 +390,8 @@ e_select_names_text_model_insert_length (ETextModel *model, gint pos, const gcha
pos += SEPLEN;
}
+ E_SELECT_NAMES_TEXT_MODEL (model)->last_magic_comma_pos = pos;
+
} else {
EReposInsertShift repos;
gint offset = MAX (pos - start_pos, 0);
@@ -473,6 +478,14 @@ e_select_names_text_model_delete (ETextModel *model, gint pos, gint length)
if (length < 0)
return;
+ if (E_SELECT_NAMES_TEXT_MODEL (model)->last_magic_comma_pos == pos+1
+ && length == 1) {
+ --pos;
+ if (pos >= 0)
+ ++length;
+ E_SELECT_NAMES_TEXT_MODEL (model)->last_magic_comma_pos = -1;
+ }
+
e_select_names_model_text_pos (source, pos, &index, &start_pos, &text_len);
if (out)
@@ -636,6 +649,7 @@ e_select_names_text_model_delete (ETextModel *model, gint pos, gint length)
}
finished:
+ E_SELECT_NAMES_TEXT_MODEL (model)->last_magic_comma_pos = -1;
gtk_signal_handler_unblock (GTK_OBJECT (source), E_SELECT_NAMES_TEXT_MODEL (model)->source_resize_id);
dump_model (E_SELECT_NAMES_TEXT_MODEL (model));
}
diff --git a/addressbook/gui/component/select-names/e-select-names-text-model.h b/addressbook/gui/component/select-names/e-select-names-text-model.h
index 7a9e0a7396..fa6ab11a63 100644
--- a/addressbook/gui/component/select-names/e-select-names-text-model.h
+++ b/addressbook/gui/component/select-names/e-select-names-text-model.h
@@ -31,6 +31,8 @@ struct _ESelectNamesTextModel {
ESelectNamesModel *source;
gint source_changed_id;
gint source_resize_id;
+
+ gint last_magic_comma_pos;
};
struct _ESelectNamesTextModelClass {