[evolution] EHTMLEditorView - New lines could be skipped when parsing the mail content into the composer



commit 8de13af1d55863a694b234f7d7cd26608e8b7f0e
Author: Tomas Popela <tpopela redhat com>
Date:   Fri Nov 13 12:55:04 2015 +0100

    EHTMLEditorView - New lines could be skipped when parsing the mail content into the composer

 e-util/e-html-editor-view.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index e1e3f9b..28fc5a1 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -6973,6 +6973,7 @@ parse_html_into_blocks (EHTMLEditorView *view,
        gboolean citation_was_first_element = FALSE;
        gboolean preserve_next_line = FALSE;
        gboolean has_citation = FALSE;
+       gboolean previously_had_empty_citation_start = FALSE;
        const gchar *prev_br, *next_br;
        GRegex *regex_nbsp = NULL, *regex_link = NULL, *regex_email = NULL;
        WebKitDOMElement *block = NULL, *block_template = passed_block_template;
@@ -7035,17 +7036,28 @@ parse_html_into_blocks (EHTMLEditorView *view,
                                ignore_next_br = TRUE;
                                if (block)
                                        append_new_block (parent, &block);
+                       } else {
+                               previously_had_empty_citation_start = TRUE;
                        }
 
                        citation_end = strstr (citation + 2, "##");
                        if (citation_end)
                                rest = citation_end + 2;
 
+                       if (rest && *rest)
+                               previously_had_empty_citation_start = FALSE;
+
                        if (first_element)
                                citation_was_first_element = TRUE;
 
                        if (block)
                                append_new_block (parent, &block);
+                       else if (with_br && rest && !*rest && previously_had_empty_citation_start && 
ignore_next_br) {
+                               /* Insert an empty block for an empty blockquote */
+                               block = create_and_append_new_block (
+                                       selection, document, parent, block_template, "<br>");
+                               previously_had_empty_citation_start = FALSE;
+                       }
 
                        citation_mark = g_utf8_substring (
                                citation, 0, g_utf8_pointer_to_offset (citation, rest));
@@ -7053,9 +7065,11 @@ parse_html_into_blocks (EHTMLEditorView *view,
                        append_citation_mark (document, parent, citation_mark);
 
                        g_free (citation_mark);
-               } else
+               } else {
                        rest = with_br ?
                                to_insert + 4 + (with_br - to_insert) : to_insert;
+                       previously_had_empty_citation_start = FALSE;
+               }
 
                if (!rest) {
                        preserve_next_line = FALSE;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]