aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Popela <tpopela@redhat.com>2014-07-15 17:53:37 +0800
committerTomas Popela <tpopela@redhat.com>2014-07-15 17:53:37 +0800
commit6f7e23e6457fc899a060da453f37620897c1ba89 (patch)
tree93470b3ea62cc0373f81ba807e990c46831a8528
parent10af33d5ef20661d535f9d559fd2752915dabbe3 (diff)
downloadgsoc2013-evolution-6f7e23e6457fc899a060da453f37620897c1ba89.tar
gsoc2013-evolution-6f7e23e6457fc899a060da453f37620897c1ba89.tar.gz
gsoc2013-evolution-6f7e23e6457fc899a060da453f37620897c1ba89.tar.bz2
gsoc2013-evolution-6f7e23e6457fc899a060da453f37620897c1ba89.tar.lz
gsoc2013-evolution-6f7e23e6457fc899a060da453f37620897c1ba89.tar.xz
gsoc2013-evolution-6f7e23e6457fc899a060da453f37620897c1ba89.tar.zst
gsoc2013-evolution-6f7e23e6457fc899a060da453f37620897c1ba89.zip
EHTMLEditorView - Replace the Tab characters in the text nodes just when generating the plain text version of the message
-rw-r--r--e-util/e-html-editor-view.c52
1 files changed, 27 insertions, 25 deletions
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index 3f4f1a2b8b..8b805b8b37 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -5184,33 +5184,35 @@ process_elements (EHTMLEditorView *view,
gint char_count = 0;
content = webkit_dom_node_get_text_content (child);
- /* Replace tabs with 8 whitespaces, otherwise they got
- * replaced by single whitespace */
- if (strstr (content, "\x9")) {
- if (buffer->str && *buffer->str) {
- gchar *start_of_line = g_strrstr_len (
- buffer->str, -1, "\n") + 1;
-
- if (start_of_line && *start_of_line)
- char_count = strlen (start_of_line);
- } else
- char_count = 0;
+ if (!changing_mode && to_plain_text) {
+ /* Replace tabs with 8 whitespaces, otherwise they got
+ * replaced by single whitespace */
+ if (strstr (content, "\x9")) {
+ if (buffer->str && *buffer->str) {
+ gchar *start_of_line = g_strrstr_len (
+ buffer->str, -1, "\n") + 1;
- regex = g_regex_new ("\x9", 0, 0, NULL);
- tmp = g_regex_replace_eval (
- regex,
- content,
- -1,
- 0,
- 0,
- (GRegexEvalCallback) replace_to_whitespaces,
- GINT_TO_POINTER (char_count),
- NULL);
+ if (start_of_line && *start_of_line)
+ char_count = strlen (start_of_line);
+ } else
+ char_count = 0;
- g_string_append (buffer, tmp);
- g_free (tmp);
- content = webkit_dom_node_get_text_content (child);
- g_regex_unref (regex);
+ regex = g_regex_new ("\x9", 0, 0, NULL);
+ tmp = g_regex_replace_eval (
+ regex,
+ content,
+ -1,
+ 0,
+ 0,
+ (GRegexEvalCallback) replace_to_whitespaces,
+ GINT_TO_POINTER (char_count),
+ NULL);
+
+ g_string_append (buffer, tmp);
+ g_free (tmp);
+ content = webkit_dom_node_get_text_content (child);
+ g_regex_unref (regex);
+ }
}
if (strstr (content, UNICODE_ZERO_WIDTH_SPACE)) {