aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Popela <tpopela@redhat.com>2014-06-19 21:11:38 +0800
committerTomas Popela <tpopela@redhat.com>2014-06-19 21:23:17 +0800
commit58112ffbdcf1affb62961694cf57eab904c1d7f8 (patch)
tree6bd32cd736ee1bd701d9dcec20b0b4945a3e77a3
parent74047473d334c3c5fb87fd37816b22693b7c260f (diff)
downloadgsoc2013-evolution-58112ffbdcf1affb62961694cf57eab904c1d7f8.tar
gsoc2013-evolution-58112ffbdcf1affb62961694cf57eab904c1d7f8.tar.gz
gsoc2013-evolution-58112ffbdcf1affb62961694cf57eab904c1d7f8.tar.bz2
gsoc2013-evolution-58112ffbdcf1affb62961694cf57eab904c1d7f8.tar.lz
gsoc2013-evolution-58112ffbdcf1affb62961694cf57eab904c1d7f8.tar.xz
gsoc2013-evolution-58112ffbdcf1affb62961694cf57eab904c1d7f8.tar.zst
gsoc2013-evolution-58112ffbdcf1affb62961694cf57eab904c1d7f8.zip
EHTMLEditorView - When quoting the elements correctly skip the selection markers
-rw-r--r--e-util/e-html-editor-view.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index ba10b1bc13..25b9bee34e 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -3405,6 +3405,29 @@ insert_quote_symbols_before_node (WebKitDOMDocument *document,
g_free (quotation);
}
+static gboolean
+element_is_selection_marker (WebKitDOMElement *element)
+{
+ gboolean is_marker = FALSE;
+
+ is_marker =
+ element_has_id (element, "-x-evo-selection-start-marker") ||
+ element_has_id (element, "-x-evo-selection-end-marker");
+
+ return is_marker;
+}
+
+static gboolean
+check_if_suppress_next_node (WebKitDOMNode *node)
+{
+ if (node && WEBKIT_DOM_IS_ELEMENT (node))
+ if (element_is_selection_marker (WEBKIT_DOM_ELEMENT (node)))
+ if (!webkit_dom_node_get_previous_sibling (node))
+ return FALSE;
+
+ return TRUE;
+}
+
static void
quote_plain_text_recursive (WebKitDOMDocument *document,
WebKitDOMNode *node,
@@ -3459,10 +3482,12 @@ quote_plain_text_recursive (WebKitDOMDocument *document,
goto next_node;
}
- if (element_has_id (WEBKIT_DOM_ELEMENT (node), "-x-evo-selection-start-marker") ||
- element_has_id (WEBKIT_DOM_ELEMENT (node), "-x-evo-selection-end-marker")) {
+ if (element_is_selection_marker (WEBKIT_DOM_ELEMENT (node))) {
move_next = TRUE;
- suppress_next = TRUE;
+ /* If there is collapsed selection in the beginning of line
+ * we cannot suppress first text that is after the end of
+ * selection */
+ suppress_next = check_if_suppress_next_node (prev_sibling);
goto next_node;
}