[evolution] Extra quoted character on the end of the quoted PRE element if it ends with BR element



commit 50c0d738e151b16b8a46294ee2b7c1c33f49ebf2
Author: Tomas Popela <tpopela redhat com>
Date:   Tue Nov 1 14:36:55 2016 +0100

    Extra quoted character on the end of the quoted PRE element if it ends with BR element
    
    Don't quoted the BR element if it does not have a next sibling.

 src/e-util/test-html-editor-units.c                |   34 ++++++++++++++++++++
 .../web-extension/e-editor-dom-functions.c         |    5 ++-
 2 files changed, 37 insertions(+), 2 deletions(-)
---
diff --git a/src/e-util/test-html-editor-units.c b/src/e-util/test-html-editor-units.c
index ce0b3f7..526c432 100644
--- a/src/e-util/test-html-editor-units.c
+++ b/src/e-util/test-html-editor-units.c
@@ -2625,6 +2625,39 @@ test_delete_quoted (TestFixture *fixture)
                g_test_fail ();
 }
 
+static void
+test_delete_after_quoted (TestFixture *fixture)
+{
+       if (!test_utils_process_commands (fixture,
+               "mode:plain\n")) {
+               g_test_fail ();
+               return;
+       }
+
+       test_utils_fixture_change_setting_boolean (fixture, "org.gnome.evolution.mail", 
"composer-wrap-quoted-text-in-replies", FALSE);
+
+       test_utils_insert_content (fixture,
+               "<body><pre>a\n"
+               "b\n"
+               "\n"
+               "<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,
+               "seq:dddbb\n",
+               HTML_PREFIX "<div style=\"width: 71ch;\">On Thu, 2016-09-15 at 08:08 -0400, user wrote:</div>"
+               "<blockquote type=\"cite\">"
+               "<pre>&gt; a</pre>"
+               "<pre>&gt; b<br></pre>"
+               "</blockquote>"
+               HTML_SUFFIX,
+               "On Thu, 2016-09-15 at 08:08 -0400, user wrote:\n"
+               "> a\n"
+               "> b"))
+               g_test_fail ();
+}
+
 gint
 main (gint argc,
       gchar *argv[])
@@ -2785,6 +2818,7 @@ main (gint argc,
        test_utils_add_test ("/undo/link-paste/html", test_undo_link_paste_html);
        test_utils_add_test ("/undo/link-paste/plain", test_undo_link_paste_plain);
        test_utils_add_test ("/delete/quoted", test_delete_quoted);
+       test_utils_add_test ("/delete/after-quoted", test_delete_after_quoted);
 
        test_add_html_editor_bug_tests ();
 
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 9bfcbdc..a54f7cb 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
@@ -1012,8 +1012,9 @@ e_editor_dom_quote_plain_text_element_after_wrapping (EEditorPage *editor_page,
                WebKitDOMNode *br = webkit_dom_node_list_item (list, ii);
                WebKitDOMNode *prev_sibling = webkit_dom_node_get_previous_sibling (br);
 
-               if (!WEBKIT_DOM_IS_ELEMENT (prev_sibling) ||
-                    !element_has_class (WEBKIT_DOM_ELEMENT (prev_sibling), "-x-evo-quoted")) {
+               if ((!WEBKIT_DOM_IS_ELEMENT (prev_sibling) ||
+                    !element_has_class (WEBKIT_DOM_ELEMENT (prev_sibling), "-x-evo-quoted")) &&
+                    webkit_dom_node_get_next_sibling (br)) {
 
                        webkit_dom_node_insert_before (
                                webkit_dom_node_get_parent_node (br),


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