[evolution] EHTMLEditorView - Pressing the Return key in the beginning of list item will delete the item



commit 6c09c26dcbfcf7eab6fbec6699078ab9d4ae1de5
Author: Tomas Popela <tpopela redhat com>
Date:   Fri Feb 12 10:48:35 2016 +0100

    EHTMLEditorView - Pressing the Return key in the beginning of list item will delete the item
    
    First check if there is something after the selection end, if nothing move to the
    selection start, not in reversed order.

 e-util/e-html-editor-view.c |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)
---
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index 13d69b5..bbf7b2e 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -5397,6 +5397,19 @@ selection_is_in_empty_list_item (WebKitDOMNode *selection_start_marker)
 
        sibling = webkit_dom_node_get_previous_sibling (WEBKIT_DOM_NODE (selection_start_marker));
 
+       /* Selection needs to be collapsed. */
+       sibling = webkit_dom_node_get_next_sibling (WEBKIT_DOM_NODE (selection_start_marker));
+       if (!e_html_editor_node_is_selection_position_node (sibling))
+               return FALSE;
+
+       /* After the selection end there could be just the BR element. */
+       sibling = webkit_dom_node_get_next_sibling (sibling);
+       if (sibling && !WEBKIT_DOM_IS_HTMLBR_ELEMENT (sibling))
+              return FALSE;
+
+       if (sibling && webkit_dom_node_get_next_sibling (sibling))
+               return FALSE;
+
        if (!sibling)
                return TRUE;
 
@@ -5418,19 +5431,6 @@ selection_is_in_empty_list_item (WebKitDOMNode *selection_start_marker)
 
        g_free (text);
 
-       /* Selection needs to be collapsed. */
-       sibling = webkit_dom_node_get_next_sibling (WEBKIT_DOM_NODE (selection_start_marker));
-       if (!e_html_editor_node_is_selection_position_node (sibling))
-               return FALSE;
-
-       /* After the selection end there could be just the BR element. */
-       sibling = webkit_dom_node_get_next_sibling (sibling);
-       if (sibling && !WEBKIT_DOM_IS_HTMLBR_ELEMENT (sibling))
-              return FALSE;
-
-       if (sibling && webkit_dom_node_get_next_sibling (sibling))
-               return FALSE;
-
        return TRUE;
 }
 


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