[evolution/gnome-3-18] EHTMLEditorSelection - Selection is wrongly restored when it is on the end of block



commit b903b21320745472eefa9fb7e4673b521c2a7cb2
Author: Tomas Popela <tpopela redhat com>
Date:   Fri Sep 25 12:36:04 2015 +0200

    EHTMLEditorSelection - Selection is wrongly restored when it is on the end of block

 e-util/e-html-editor-selection.c |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/e-util/e-html-editor-selection.c b/e-util/e-html-editor-selection.c
index d67a3f6..349ac35 100644
--- a/e-util/e-html-editor-selection.c
+++ b/e-util/e-html-editor-selection.c
@@ -7617,15 +7617,21 @@ e_html_editor_selection_restore (EHTMLEditorSelection *selection)
 
                                ok = e_html_editor_node_is_selection_position_node (selection_end_marker);
                                if (ok) {
-                                       parent_start = webkit_dom_node_get_parent_node (selection_end_marker);
+                                       WebKitDOMNode *next_sibling;
 
-                                       remove_node (selection_start_marker);
-                                       remove_node (selection_end_marker);
+                                       next_sibling = webkit_dom_node_get_next_sibling 
(selection_end_marker);
 
-                                       webkit_dom_node_normalize (parent_start);
-                                       g_object_unref (range);
-                                       g_object_unref (dom_selection);
-                                       return;
+                                       if (next_sibling && !WEBKIT_DOM_IS_HTMLBR_ELEMENT (next_sibling)) {
+                                               parent_start = webkit_dom_node_get_parent_node 
(selection_end_marker);
+
+                                               remove_node (selection_start_marker);
+                                               remove_node (selection_end_marker);
+
+                                               webkit_dom_node_normalize (parent_start);
+                                               g_object_unref (range);
+                                               g_object_unref (dom_selection);
+                                               return;
+                                       }
                                }
                        }
                }


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