[evolution] Bug 775691 - Paste eats new line marker



commit fe7854aec02bb1d8d3ca2746338f6ca1d151ad90
Author: Tomas Popela <tpopela redhat com>
Date:   Wed Dec 7 14:22:23 2016 +0100

    Bug 775691 - Paste eats new line marker
    
    Don't use a workaround in the e_editor_dom_insert_html function if
    inserting content that's coming from composer.

 src/e-util/test-html-editor-units-bugs.c           |   19 +++++++++++++++++++
 .../web-extension/e-editor-dom-functions.c         |   18 ++++++++++--------
 2 files changed, 29 insertions(+), 8 deletions(-)
---
diff --git a/src/e-util/test-html-editor-units-bugs.c b/src/e-util/test-html-editor-units-bugs.c
index 97b3654..e0cb9a1 100644
--- a/src/e-util/test-html-editor-units-bugs.c
+++ b/src/e-util/test-html-editor-units-bugs.c
@@ -810,6 +810,24 @@ test_bug_775042 (TestFixture *fixture)
                g_test_fail ();
 }
 
+static void
+test_bug_775691 (TestFixture *fixture)
+{
+       if (!test_utils_run_simple_test (fixture,
+               "mode:plain\n"
+               "type:abc def ghi\\n\n"
+               "seq:urrrrSrrrs\n"
+               "action:copy\n"
+               "seq:d\n"
+               "action:paste\n",
+               HTML_PREFIX "<div style=\"width: 71ch;\">abc def ghi</div>"
+               "<div style=\"width: 71ch;\">def</div>"
+               HTML_SUFFIX,
+               "abc def ghi\n"
+               "def"))
+               g_test_fail ();
+}
+
 void
 test_add_html_editor_bug_tests (void)
 {
@@ -830,4 +848,5 @@ test_add_html_editor_bug_tests (void)
        test_utils_add_test ("/bug/772918", test_bug_772918);
        test_utils_add_test ("/bug/773164", test_bug_773164);
        test_utils_add_test ("/bug/775042", test_bug_775042);
+       test_utils_add_test ("/bug/775691", test_bug_775691);
 }
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 97ac306..313244b 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
@@ -8754,16 +8754,18 @@ e_editor_dom_insert_html (EEditorPage *editor_page,
                         * empty after we insert the content. */
                        selection_marker = webkit_dom_document_get_element_by_id (
                                document, "-x-evo-selection-start-marker");
-                       if (!webkit_dom_node_get_previous_sibling (WEBKIT_DOM_NODE (selection_marker))) {
-                               WebKitDOMNode *sibling;
 
-                               sibling = webkit_dom_node_get_next_sibling (WEBKIT_DOM_NODE 
(selection_marker));
-                               sibling = webkit_dom_node_get_next_sibling (sibling);
-                               if (WEBKIT_DOM_IS_HTML_BR_ELEMENT (sibling)) {
-                                       block = e_editor_dom_get_parent_block_node_from_child 
(WEBKIT_DOM_NODE (selection_marker));
-                                       remove_node (sibling);
+                       if (!e_editor_page_is_pasting_content_from_itself (editor_page)) {
+                               if (!webkit_dom_node_get_previous_sibling (WEBKIT_DOM_NODE 
(selection_marker))) {
+                                       WebKitDOMNode *sibling;
+
+                                       sibling = webkit_dom_node_get_next_sibling (WEBKIT_DOM_NODE 
(selection_marker));
+                                       sibling = webkit_dom_node_get_next_sibling (sibling);
+                                       if (WEBKIT_DOM_IS_HTML_BR_ELEMENT (sibling))
+                                               remove_node (sibling);
                                }
                        }
+                       block = e_editor_dom_get_parent_block_node_from_child (WEBKIT_DOM_NODE 
(selection_marker));
 
                        e_editor_dom_selection_restore (editor_page);
                }


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