[evolution] EHTMLEditorView - History for Delete could not be saved
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] EHTMLEditorView - History for Delete could not be saved
- Date: Tue, 25 Aug 2015 08:53:32 +0000 (UTC)
commit 808eabf688b86e4302aa43518ae79166371aa024
Author: Tomas Popela <tpopela redhat com>
Date: Tue Aug 25 10:36:27 2015 +0200
EHTMLEditorView - History for Delete could not be saved
We have to look if the next node is selection marker, if so we have to skip it
and select the first character after it. Before this change the marker was
selection and later the whole history event was discard because of an empty
data provided to it.
e-util/e-html-editor-view.c | 28 ++++++++++++++++++++++------
1 files changed, 22 insertions(+), 6 deletions(-)
---
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index 1cc6be0..2cd0b11 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -4097,12 +4097,28 @@ save_history_for_delete_or_backspace (EHTMLEditorView *view,
g_object_unref (tmp_range);
} else {
if (delete_key) {
- glong offset = webkit_dom_range_get_start_offset (range_clone, NULL);
- webkit_dom_range_set_end (
- range_clone,
- webkit_dom_range_get_end_container (range_clone, NULL),
- offset + 1,
- NULL);
+ WebKitDOMNode *container, *next_sibling;
+
+ container = webkit_dom_range_get_end_container (range_clone, NULL);
+ next_sibling = webkit_dom_node_get_next_sibling (container);
+
+ if (e_html_editor_node_is_selection_position_node (next_sibling)) {
+ WebKitDOMNode *next_node;
+
+ next_node = webkit_dom_node_get_next_sibling (
+ webkit_dom_node_get_next_sibling (next_sibling));
+ webkit_dom_range_set_start (
+ range_clone, next_node, 0, NULL);
+ webkit_dom_range_set_end (
+ range_clone, next_node, 1, NULL);
+ } else {
+ glong offset;
+
+ offset = webkit_dom_range_get_start_offset (range_clone, NULL);
+
+ webkit_dom_range_set_end (
+ range_clone, container, offset + 1, NULL);
+ }
} else {
webkit_dom_range_set_start (
range_clone,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]