[evolution/wip/webkit-composer: 330/372] EEditorSelection: Fix unindentation



commit 6b17980ed1e7310a0d7602ac5508fc40935ac350
Author: Tomas Popela <tpopela redhat com>
Date:   Thu Jan 16 15:37:21 2014 +0100

    EEditorSelection: Fix unindentation
    
    When we have this text with indentation in composer:
    first_line
       a
    
       a
    
       X
    
    And we have cursor instead of X and we will try to unindent that line
    it will remove all after the first a. We have to mark the element that
    we want to unindent (with -x-evo-to-unindent class) to prevent
    webkit_node_is_equal_node return false positives when it will hit other empty
    lines like in this case.

 e-util/e-editor-selection.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/e-util/e-editor-selection.c b/e-util/e-editor-selection.c
index 5e9ff62..9864e50 100644
--- a/e-util/e-editor-selection.c
+++ b/e-util/e-editor-selection.c
@@ -1968,6 +1968,8 @@ e_editor_selection_unindent (EEditorSelection *selection)
                        return;
                }
 
+               element_add_class (WEBKIT_DOM_ELEMENT (node), "-x-evo-to-unindent");
+
                level = get_indentation_level (element);
                clone = WEBKIT_DOM_NODE (webkit_dom_node_clone_node (WEBKIT_DOM_NODE (element), TRUE));
 
@@ -2051,6 +2053,8 @@ e_editor_selection_unindent (EEditorSelection *selection)
                        webkit_dom_node_remove_child (clone, child, NULL);
                }
 
+               element_remove_class (WEBKIT_DOM_ELEMENT (node_clone), "-x-evo-to-unindent");
+
                /* Insert blockqoute with nodes that were before the element that we want to unindent */
                if (prev_blockquote) {
                        if (webkit_dom_node_has_child_nodes (WEBKIT_DOM_NODE (prev_blockquote))) {


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