[evolution] EHTMLEditorView - Replace the Tab characters in the text nodes just when generating the plain text v
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] EHTMLEditorView - Replace the Tab characters in the text nodes just when generating the plain text v
- Date: Tue, 15 Jul 2014 09:54:56 +0000 (UTC)
commit 6f7e23e6457fc899a060da453f37620897c1ba89
Author: Tomas Popela <tpopela redhat com>
Date: Tue Jul 15 11:53:37 2014 +0200
EHTMLEditorView - Replace the Tab characters in the text nodes just when generating the plain text
version of the message
e-util/e-html-editor-view.c | 54 ++++++++++++++++++++++--------------------
1 files changed, 28 insertions(+), 26 deletions(-)
---
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index 3f4f1a2..8b805b8 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)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]