[evolution/gnome-3-24] Bug 781116 - Wrap Lines in citation breaks citation



commit b12cc1f735198e95577a0a0e835cf0f95a853bda
Author: Tomas Popela <tpopela redhat com>
Date:   Fri Apr 28 13:11:20 2017 +0200

    Bug 781116 - Wrap Lines in citation breaks citation
    
    The content is already wrapped, so we should use the function that is
    quoting the content after wrapping as it is faster and more reliable.

 src/e-util/test-html-editor-units-bugs.c           |   35 ++++++++++++++++++++
 .../web-extension/e-editor-dom-functions.c         |    3 +-
 2 files changed, 37 insertions(+), 1 deletions(-)
---
diff --git a/src/e-util/test-html-editor-units-bugs.c b/src/e-util/test-html-editor-units-bugs.c
index 984b211..2c6bbd5 100644
--- a/src/e-util/test-html-editor-units-bugs.c
+++ b/src/e-util/test-html-editor-units-bugs.c
@@ -980,6 +980,40 @@ test_bug_781722 (TestFixture *fixture)
                g_test_fail ();
 }
 
+static void
+test_bug_781116 (TestFixture *fixture)
+{
+       test_utils_fixture_change_setting_boolean (fixture, "org.gnome.evolution.mail", 
"composer-wrap-quoted-text-in-replies", FALSE);
+
+       if (!test_utils_process_commands (fixture,
+               "mode:plain\n")) {
+               g_test_fail ();
+               return;
+       }
+
+       test_utils_insert_content (fixture,
+               "<pre>a very long text, which splits into multiple lines when this paragraph is not marked as 
preformatted, but as normal, as it should be</pre>\n"
+               "</pre><span class=\"-x-evo-to-body\" data-credits=\"Credits:\"></span>"
+               "<span class=\"-x-evo-cite-body\"></span>",
+               E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
+
+       if (!test_utils_run_simple_test (fixture,
+               "seq:dd\n"
+               "action:wrap-lines\n",
+               HTML_PREFIX "<div style=\"width: 71ch;\">Credits:</div>"
+               "<blockquote type=\"cite\">"
+               "<pre>&gt; a very long text, which splits into multiple lines when this<br>"
+               "&gt; paragraph is not marked as preformatted, but as normal, as it should<br>"
+               "&gt; be</pre>"
+               "</blockquote>"
+               HTML_SUFFIX,
+               "Credits:\n"
+               "> a very long text, which splits into multiple lines when this\n"
+               "> paragraph is not marked as preformatted, but as normal, as it should\n"
+               "> be</pre>"))
+               g_test_fail ();
+}
+
 void
 test_add_html_editor_bug_tests (void)
 {
@@ -1005,4 +1039,5 @@ test_add_html_editor_bug_tests (void)
        test_utils_add_test ("/bug/780275/html", test_bug_780275_html);
        test_utils_add_test ("/bug/780275/plain", test_bug_780275_plain);
        test_utils_add_test ("/bug/781722", test_bug_781722);
+       test_utils_add_test ("/bug/781116", test_bug_781116);
 }
diff --git a/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c 
b/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
index 1df2eed..5ef75cf 100644
--- a/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
+++ b/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
@@ -14482,7 +14482,8 @@ e_editor_dom_selection_wrap (EEditorPage *editor_page)
                        wrapped_paragraph, "data-user-wrapped", "", NULL);
 
                if (quoted && !html_mode)
-                       e_editor_dom_quote_plain_text_element (editor_page, wrapped_paragraph);
+                       e_editor_dom_quote_plain_text_element_after_wrapping (
+                               editor_page, wrapped_paragraph, citation_level);
 
                block = next_block;
        }


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