[evolution] Bug 731551 - [webkit-composer] Whitespace lost on message reply (plain text)
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Bug 731551 - [webkit-composer] Whitespace lost on message reply (plain text)
- Date: Fri, 13 Jun 2014 12:58:19 +0000 (UTC)
commit 0f4b202c4ac663ca3df8d3146601c5c9a3892575
Author: Tomas Popela <tpopela redhat com>
Date: Fri Jun 13 14:37:47 2014 +0200
Bug 731551 - [webkit-composer] Whitespace lost on message reply (plain text)
Replace whitespace with non breaking space ( ) to avoid its lost.
Also when generating the plain text version of final message replace
non breaking space with normal space.
e-util/e-html-editor-view.c | 19 ++++++++++++++++++-
1 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index 6c68b70..02965c9 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -36,6 +36,7 @@
((obj), E_TYPE_HTML_EDITOR_VIEW, EHTMLEditorViewPrivate))
#define UNICODE_ZERO_WIDTH_SPACE "\xe2\x80\x8b"
+#define UNICODE_NBSP "\xc2\xa0"
#define URL_PATTERN \
"((([A-Za-z]{3,9}:(?:\\/\\/)?)(?:[\\-;:&=\\+\\$,\\w]+@)?" \
@@ -2387,9 +2388,13 @@ parse_html_into_paragraphs (EHTMLEditorView *view,
}
if (rest && *rest){
+ gchar *rest_to_insert = g_strdup (rest);
GString *space_to_nbsp;
- space_to_nbsp = replace_string_spaces_with_nbsp_in_prefix (rest);
+ g_strchomp (rest_to_insert);
+ space_to_nbsp = e_str_replace_string (
+ rest_to_insert, " ", " ");
+
webkit_dom_html_element_set_inner_html (
WEBKIT_DOM_HTML_ELEMENT (paragraph),
space_to_nbsp->str,
@@ -2399,7 +2404,9 @@ parse_html_into_paragraphs (EHTMLEditorView *view,
WEBKIT_DOM_NODE (blockquote),
WEBKIT_DOM_NODE (paragraph),
NULL);
+
g_string_free (space_to_nbsp, TRUE);
+ g_free (rest_to_insert);
}
if (citation_end)
@@ -4354,6 +4361,16 @@ process_elements (EHTMLEditorView *view,
gchar *style;
const gchar *css_align;
+ if (strstr (content, UNICODE_NBSP)) {
+ GString *nbsp_free;
+
+ nbsp_free = e_str_replace_string (
+ content, UNICODE_NBSP, " ");
+
+ g_free (content);
+ content = g_string_free (nbsp_free, FALSE);
+ }
+
style = webkit_dom_element_get_attribute (
WEBKIT_DOM_ELEMENT (node), "style");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]