[evolution/wip/webkit2] EHTMLEditorView - Rework how the possibility of de-indenting a block is detected
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit2] EHTMLEditorView - Rework how the possibility of de-indenting a block is detected
- Date: Wed, 22 Apr 2015 13:16:52 +0000 (UTC)
commit abb8f4e818195d9afc22f31c2e72527a4cf7dad3
Author: Tomas Popela <tpopela redhat com>
Date: Wed Apr 22 11:34:21 2015 +0200
EHTMLEditorView - Rework how the possibility of de-indenting a block is detected
web-extensions/e-html-editor-view-dom-functions.c | 23 +++++++++-----------
1 files changed, 10 insertions(+), 13 deletions(-)
---
diff --git a/web-extensions/e-html-editor-view-dom-functions.c
b/web-extensions/e-html-editor-view-dom-functions.c
index e85ea23..f5e7200 100644
--- a/web-extensions/e-html-editor-view-dom-functions.c
+++ b/web-extensions/e-html-editor-view-dom-functions.c
@@ -7113,26 +7113,23 @@ dom_process_on_key_press (WebKitDOMDocument *document,
remove_input_event_listener_from_body (document, extension);
/* BackSpace in indented block decrease indent level by one */
- if (dom_selection_is_indented (document)) {
- WebKitDOMElement *caret;
+ if (dom_selection_is_indented (document) &&
+ dom_selection_is_collapsed (document)) {
+ WebKitDOMElement *selection_start;
WebKitDOMNode *prev_sibling;
- caret = dom_save_caret_position (document);
+ dom_selection_save (document);
+ selection_start = webkit_dom_document_get_element_by_id (
+ document, "-x-evo-selection-start-marker");
/* Empty text node before caret */
prev_sibling = webkit_dom_node_get_previous_sibling (
- WEBKIT_DOM_NODE (caret));
- if (prev_sibling && WEBKIT_DOM_IS_TEXT (prev_sibling)) {
- gchar *content;
-
- content = webkit_dom_node_get_text_content (prev_sibling);
- if (g_strcmp0 (content, "") == 0)
+ WEBKIT_DOM_NODE (selection_start));
+ if (prev_sibling && WEBKIT_DOM_IS_TEXT (prev_sibling))
+ if (webkit_dom_character_data_get_length (WEBKIT_DOM_CHARACTER_DATA
(prev_sibling)) == 0)
prev_sibling = webkit_dom_node_get_previous_sibling (prev_sibling);
- g_free (content);
- }
-
- dom_clear_caret_position_marker (document);
+ dom_selection_restore (document);
if (!prev_sibling) {
dom_selection_unindent (document, extension);
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]