[evolution/wip/webkit2] EHTMLEditorView - Check if the Backspace or Delete operation can remove anything
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit2] EHTMLEditorView - Check if the Backspace or Delete operation can remove anything
- Date: Wed, 2 Mar 2016 17:55:14 +0000 (UTC)
commit 3374f156587d536f7b9579b937d16412c91407fa
Author: Tomas Popela <tpopela redhat com>
Date: Wed Mar 2 18:54:10 2016 +0100
EHTMLEditorView - Check if the Backspace or Delete operation can remove anything
.../composer/e-html-editor-view-dom-functions.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/web-extensions/composer/e-html-editor-view-dom-functions.c
b/web-extensions/composer/e-html-editor-view-dom-functions.c
index 78da63b..1719c65 100644
--- a/web-extensions/composer/e-html-editor-view-dom-functions.c
+++ b/web-extensions/composer/e-html-editor-view-dom-functions.c
@@ -7760,6 +7760,26 @@ save_history_for_delete_or_backspace (WebKitDOMDocument *document,
range = webkit_dom_dom_selection_get_range_at (dom_selection, 0, NULL);
+ /* Check if we can delete something */
+ if (webkit_dom_range_get_collapsed (range, NULL)) {
+ WebKitDOMRange *tmp_range;
+
+ webkit_dom_dom_selection_modify (
+ dom_selection, "move", delete_key ? "right" : "left", "character");
+
+ tmp_range = webkit_dom_dom_selection_get_range_at (dom_selection, 0, NULL);
+ if (webkit_dom_range_compare_boundary_points (tmp_range, 2, range, NULL) == 0) {
+ g_object_unref (dom_selection);
+ g_object_unref (range);
+ g_object_unref (tmp_range);
+
+ return;
+ }
+
+ webkit_dom_dom_selection_modify (
+ dom_selection, "move", delete_key ? "left" : "right", "character");
+ }
+
if (save_history_before_event_in_table (document, extension, range)) {
g_object_unref (range);
g_object_unref (dom_selection);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]