[evolution/gnome-3-22] Extra quoted character on the end of the quoted PRE element if it ends with BR element



commit ae19395d8ba7b77df2daa0bb5041dbdad55e0bd1
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.

 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/e-util/test-html-editor-units.c b/e-util/test-html-editor-units.c
index 9db23aa..c6750fc 100644
--- a/e-util/test-html-editor-units.c
+++ b/e-util/test-html-editor-units.c
@@ -2627,6 +2627,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[])
@@ -2787,6 +2820,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/modules/webkit-editor/web-extension/e-editor-dom-functions.c 
b/modules/webkit-editor/web-extension/e-editor-dom-functions.c
index ee7d839..8fa04a8 100644
--- a/modules/webkit-editor/web-extension/e-editor-dom-functions.c
+++ b/modules/webkit-editor/web-extension/e-editor-dom-functions.c
@@ -1014,8 +1014,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]