aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Popela <tpopela@redhat.com>2014-06-13 20:37:47 +0800
committerTomas Popela <tpopela@redhat.com>2014-06-13 20:57:26 +0800
commit0f4b202c4ac663ca3df8d3146601c5c9a3892575 (patch)
tree367d41b6b3d833cf94c3131aaa135fd07395f490
parent3928bfba24cc340d2445f2412a0b5646c52755e8 (diff)
downloadgsoc2013-evolution-0f4b202c4ac663ca3df8d3146601c5c9a3892575.tar
gsoc2013-evolution-0f4b202c4ac663ca3df8d3146601c5c9a3892575.tar.gz
gsoc2013-evolution-0f4b202c4ac663ca3df8d3146601c5c9a3892575.tar.bz2
gsoc2013-evolution-0f4b202c4ac663ca3df8d3146601c5c9a3892575.tar.lz
gsoc2013-evolution-0f4b202c4ac663ca3df8d3146601c5c9a3892575.tar.xz
gsoc2013-evolution-0f4b202c4ac663ca3df8d3146601c5c9a3892575.tar.zst
gsoc2013-evolution-0f4b202c4ac663ca3df8d3146601c5c9a3892575.zip
Bug 731551 - [webkit-composer] Whitespace lost on message reply (plain text)
Replace whitespace with non breaking space (&nbsp;) to avoid its lost. Also when generating the plain text version of final message replace non breaking space with normal space.
-rw-r--r--e-util/e-html-editor-view.c19
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 6c68b70a1d..02965c93cc 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, " ", "&nbsp;");
+
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");