[evolution] EHTMLEditorView - Busy loop when replying to certain mail



commit 1e96269767b0a8be0b2f0aa41cf0ee3140229476
Author: Tomas Popela <tpopela redhat com>
Date:   Tue Oct 20 13:04:48 2015 +0200

    EHTMLEditorView - Busy loop when replying to certain mail
    
    Avoid busy loop in the wrap_lines function when replying to [0]. The problem was
    that when we inserted the BR element before the actual node we didn't move we
    moved to the next node that was again the very same node.
    
    [0] - https://mail.gnome.org/archives/evolution-list/2015-October/msg00077.html

 e-util/e-html-editor-selection.c |   16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)
---
diff --git a/e-util/e-html-editor-selection.c b/e-util/e-html-editor-selection.c
index 79e1bcc..a377fa0 100644
--- a/e-util/e-html-editor-selection.c
+++ b/e-util/e-html-editor-selection.c
@@ -6829,18 +6829,20 @@ wrap_lines (EHTMLEditorSelection *selection,
                                }
                        }
 
-                       if (offset > 0) {
+                       if (offset >= 0) {
                                WebKitDOMNode *nd;
 
-                               if (offset != length_left)
+                               if (offset != length_left && offset != 0) {
                                        webkit_dom_text_split_text (
                                                WEBKIT_DOM_TEXT (node), offset, NULL);
 
-                               nd = webkit_dom_node_get_next_sibling (node);
+                                       nd = webkit_dom_node_get_next_sibling (node);
+                               } else
+                                       nd = node;
+
                                if (nd) {
                                        gchar *nd_content;
 
-
                                        nd_content = webkit_dom_node_get_text_content (nd);
                                        if (nd_content && *nd_content) {
                                                if (*nd_content == ' ')
@@ -6868,12 +6870,6 @@ wrap_lines (EHTMLEditorSelection *selection,
                                                WEBKIT_DOM_NODE (element),
                                                NULL);
                                }
-                       } else {
-                               webkit_dom_node_insert_before (
-                                       webkit_dom_node_get_parent_node (node),
-                                       WEBKIT_DOM_NODE (element),
-                                       node,
-                                       NULL);
                        }
                        if (node && WEBKIT_DOM_IS_CHARACTER_DATA (node))
                                length_left = webkit_dom_character_data_get_length (


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