[evolution/wip/tpopela/composer-fixes] Bug 771493 - Missing '>' in message reply



commit ac330ac674639159961c3325eaab5d6b6a25dc5a
Author: Tomas Popela <tpopela redhat com>
Date:   Mon Sep 19 10:27:15 2016 +0200

    Bug 771493 - Missing '>' in message reply
    
    When parsing the HTML content to blocks we cannot look for the first "<br>"
    token from the first position of input as when the input will start with the
    same token, then we will later exit the processing loop prematurely as we won't
    have a non-empty content to process.

 e-util/test-html-editor-units-bugs.c               |   38 ++++++++++++++++++++
 .../web-extension/e-editor-dom-functions.c         |    2 +-
 2 files changed, 39 insertions(+), 1 deletions(-)
---
diff --git a/e-util/test-html-editor-units-bugs.c b/e-util/test-html-editor-units-bugs.c
index 495f8a2..9e71bb0 100644
--- a/e-util/test-html-editor-units-bugs.c
+++ b/e-util/test-html-editor-units-bugs.c
@@ -632,6 +632,43 @@ test_bug_771131 (TestFixture *fixture)
                g_test_fail ();
 }
 
+static void
+test_bug_771493 (TestFixture *fixture)
+{
+       if (!test_utils_process_commands (fixture,
+               "mode:plain\n")) {
+               g_test_fail ();
+               return;
+       }
+
+       test_utils_insert_content (fixture,
+               "<body><pre><br>"
+               "----- Original Message -----\n"
+               "<blockquote type=\"cite\">\n"
+               "This week summary:"
+               "</blockquote>"
+               "</pre><span class=\"-x-evo-to-body\" data-credits=\"On Thu, 2016-09-15 at 08:08 -0400, user 
wrote:\"></span>"
+               "<span class=\"-x-evo-cite-body\"></span></body>",
+               E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
+
+       if (!test_utils_run_simple_test (fixture,
+               "",
+               HTML_PREFIX_PLAIN "<div style=\"width: 71ch;\">On Thu, 2016-09-15 at 08:08 -0400, user 
wrote:</div>"
+               "<blockquote type=\"cite\">"
+               "<div style=\"width: 71ch;\">&gt; <br></div>"
+               "<div style=\"width: 71ch;\">&gt; ----- Original Message -----</div>"
+               "<blockquote type=\"cite\">"
+               "<div style=\"width: 71ch;\">&gt; &gt; This week summary:</div>"
+               "</blockquote>"
+               "</blockquote>"
+               HTML_SUFFIX,
+               "On Thu, 2016-09-15 at 08:08 -0400, user wrote:\n"
+               "> \n"
+               "> ----- Original Message -----\n"
+               "> > This week summary:"))
+               g_test_fail ();
+}
+
 void
 test_add_html_editor_bug_tests (void)
 {
@@ -646,4 +683,5 @@ test_add_html_editor_bug_tests (void)
        test_utils_add_test ("/bug/770074", test_bug_770074);
        test_utils_add_test ("/bug/771044", test_bug_771044);
        test_utils_add_test ("/bug/771131", test_bug_771131);
+       test_utils_add_test ("/bug/771493", test_bug_771493);
 }
diff --git a/modules/webkit-editor/web-extension/e-editor-dom-functions.c 
b/modules/webkit-editor/web-extension/e-editor-dom-functions.c
index faa0648..5abb918 100644
--- a/modules/webkit-editor/web-extension/e-editor-dom-functions.c
+++ b/modules/webkit-editor/web-extension/e-editor-dom-functions.c
@@ -5169,7 +5169,7 @@ parse_html_into_blocks (EEditorPage *editor_page,
        html = remove_new_lines_around_citations (input);
 
        prev_token = html->str;
-       next_token = strstr (prev_token, "<br>");
+       next_token = strstr (prev_token + 1, "<br>");
        processing_last = !next_token;
 
        while (next_token || processing_last) {


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