[evolution] Bug 771131 - Replying in plain text to plain text ignores quotation level



commit 1362feb764d630e91c8c2ddcc2c02017b898b8c7
Author: Tomas Popela <tpopela redhat com>
Date:   Mon Sep 12 09:58:19 2016 +0200

    Bug 771131 - Replying in plain text to plain text ignores quotation level
    
    We were not inserting the citation start marker in parse_html_into_blocks() when
    it was after the text to process and the line did not started with BR element.
    Only the citation end mark was inserted in this case, thus the citation was not
    constructed properly.

 e-util/test-html-editor-units-bugs.c               |   45 ++++++++++++++++++++
 .../web-extension/e-editor-dom-functions.c         |    3 +
 2 files changed, 48 insertions(+), 0 deletions(-)
---
diff --git a/e-util/test-html-editor-units-bugs.c b/e-util/test-html-editor-units-bugs.c
index e1bb7a3..495f8a2 100644
--- a/e-util/test-html-editor-units-bugs.c
+++ b/e-util/test-html-editor-units-bugs.c
@@ -588,6 +588,50 @@ test_bug_771044 (TestFixture *fixture)
                g_test_fail ();
 }
 
+static void
+test_bug_771131 (TestFixture *fixture)
+{
+       if (!test_utils_process_commands (fixture,
+               "mode:plain\n")) {
+               g_test_fail ();
+               return;
+       }
+
+       test_utils_insert_content (fixture,
+               "<body><pre>On &lt;date1&gt;, &lt;name1&gt; wrote:\n"
+               "<blockquote type=\"cite\">\n"
+               "Hello\n"
+               "\n"
+               "Goodbye</blockquote>"
+               "<div><span>the 3rd line text</span></div>"
+               "</pre><span class=\"-x-evo-to-body\" data-credits=\"On Sat, 2016-09-10 at 20:00 +0000, 
example example com 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 Sat, 2016-09-10 at 20:00 +0000, example 
example com wrote:</div>"
+               "<blockquote type=\"cite\">"
+               "<div style=\"width: 71ch;\">&gt; On &lt;date1&gt;, &lt;name1&gt; wrote:</div>"
+               "<blockquote type=\"cite\">"
+               "<div style=\"width: 71ch;\">&gt; &gt; Hello</div>"
+               "<div style=\"width: 71ch;\">&gt; &gt; <br></div>"
+               "<div style=\"width: 71ch;\">&gt; &gt; Goodbye</div>"
+               "</blockquote>"
+               "<div style=\"width: 71ch;\">&gt; <br></div>"
+               "<div style=\"width: 71ch;\">&gt; the 3rd line text</div>"
+               "</blockquote>"
+               HTML_SUFFIX,
+               "On Sat, 2016-09-10 at 20:00 +0000, example example com wrote:\n"
+               "> On <date1>, <name1> wrote:\n"
+               "> > Hello\n"
+               "> > \n"
+               "> > Goodbye\n"
+               "> \n"
+               "> the 3rd line text"))
+               g_test_fail ();
+}
+
 void
 test_add_html_editor_bug_tests (void)
 {
@@ -601,4 +645,5 @@ test_add_html_editor_bug_tests (void)
        test_utils_add_test ("/bug/770073", test_bug_770073);
        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);
 }
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 5ebe8b0..2fd63bf 100644
--- a/modules/webkit-editor/web-extension/e-editor-dom-functions.c
+++ b/modules/webkit-editor/web-extension/e-editor-dom-functions.c
@@ -5305,6 +5305,9 @@ parse_html_into_blocks (EEditorPage *editor_page,
                if (with_br && citation_start && citation_start != with_br + 4)
                        append_citation_mark (document, parent, "##CITATION_START##");
 
+               if (!with_br && citation_start && citation_start != to_process)
+                       append_citation_mark (document, parent, "##CITATION_START##");
+
                if (citation_end && citation_end != to_process)
                        append_citation_mark (document, parent, "##CITATION_END##");
 


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