[evolution/gnome-3-26] Bug 791341 - Support pasting multiple addresses with line breaks
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/gnome-3-26] Bug 791341 - Support pasting multiple addresses with line breaks
- Date: Wed, 3 Jan 2018 17:02:46 +0000 (UTC)
commit 07129d4a74b9b786f4b3e066191ad6817a7c3c7e
Author: Milan Crha <mcrha redhat com>
Date: Wed Jan 3 18:00:55 2018 +0100
Bug 791341 - Support pasting multiple addresses with line breaks
src/e-util/e-name-selector-entry.c | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/src/e-util/e-name-selector-entry.c b/src/e-util/e-name-selector-entry.c
index 3786f38..aaac0e7 100644
--- a/src/e-util/e-name-selector-entry.c
+++ b/src/e-util/e-name-selector-entry.c
@@ -1603,7 +1603,9 @@ user_insert_text (ENameSelectorEntry *name_selector_entry,
fast_insert =
(g_utf8_strchr (new_text, new_text_length, ' ') == NULL) &&
- (g_utf8_strchr (new_text, new_text_length, ',') == NULL);
+ (g_utf8_strchr (new_text, new_text_length, ',') == NULL) &&
+ (g_utf8_strchr (new_text, new_text_length, '\t') == NULL) &&
+ (g_utf8_strchr (new_text, new_text_length, '\n') == NULL);
/* If the text to insert does not contain spaces or commas,
* insert all of it at once. This avoids confusing on-going
@@ -1623,9 +1625,22 @@ user_insert_text (ENameSelectorEntry *name_selector_entry,
* can be inserted, and insert a trailing space after comma. */
} else {
const gchar *cp;
+ gboolean last_was_comma = FALSE;
for (cp = new_text; *cp; cp = g_utf8_next_char (cp)) {
gunichar uc = g_utf8_get_char (cp);
+
+ if (uc == '\n' || uc == '\t') {
+ if (last_was_comma)
+ continue;
+ last_was_comma = TRUE;
+ uc = ',';
+ } else if (uc == '\r') {
+ continue;
+ } else {
+ last_was_comma = uc == ',';
+ }
+
insert_unichar (name_selector_entry, position, uc);
chars_inserted++;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]