[evolution] EHTMLEditorSelection - Remove previously inserted BR if correcting wrapping around selection markers



commit 095edc9e877f361da436f89f2dff9bb68147e902
Author: Tomas Popela <tpopela redhat com>
Date:   Fri Nov 20 14:26:29 2015 +0100

    EHTMLEditorSelection - Remove previously inserted BR if correcting wrapping around selection markers

 e-util/e-html-editor-selection.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/e-util/e-html-editor-selection.c b/e-util/e-html-editor-selection.c
index 57a52d4..3343473 100644
--- a/e-util/e-html-editor-selection.c
+++ b/e-util/e-html-editor-selection.c
@@ -6756,12 +6756,20 @@ wrap_lines (EHTMLEditorSelection *selection,
                                        check_next_node = FALSE;
                                        prev_sibling = webkit_dom_node_get_previous_sibling (node);
                                        if (prev_sibling && e_html_editor_node_is_selection_position_node 
(prev_sibling)) {
+                                               WebKitDOMNode *prev_br = NULL;
+
                                                prev_sibling = webkit_dom_node_get_previous_sibling 
(prev_sibling);
 
                                                /* Collapsed selection */
                                                if (prev_sibling && 
e_html_editor_node_is_selection_position_node (prev_sibling))
                                                        prev_sibling = webkit_dom_node_get_previous_sibling 
(prev_sibling);
 
+                                               if (prev_sibling && WEBKIT_DOM_IS_HTMLBR_ELEMENT 
(prev_sibling) &&
+                                                   element_has_class (WEBKIT_DOM_ELEMENT (prev_sibling), 
"-x-evo-wrap-br")) {
+                                                       prev_br = prev_sibling;
+                                                       prev_sibling = webkit_dom_node_get_previous_sibling 
(prev_sibling);
+                                               }
+
                                                if (prev_sibling && WEBKIT_DOM_IS_CHARACTER_DATA 
(prev_sibling)) {
                                                        gchar *data;
                                                        glong text_length, length = 0;
@@ -6802,7 +6810,9 @@ wrap_lines (EHTMLEditorSelection *selection,
                                                                        }
 
                                                                        if (nd) {
-                                                                               webkit_dom_node_insert_before 
(
+                                                                               if (prev_br)
+                                                                                       remove_node (prev_br);
+                                                                                
webkit_dom_node_insert_before (
                                                                                        
webkit_dom_node_get_parent_node (nd),
                                                                                        WEBKIT_DOM_NODE 
(element),
                                                                                        nd,


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