[evolution/gnome-3-18] EHTMLEditorView - Check if the Backspace or Delete operation can remove anything
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/gnome-3-18] EHTMLEditorView - Check if the Backspace or Delete operation can remove anything
- Date: Mon, 23 Nov 2015 12:52:50 +0000 (UTC)
commit f3368ad7c730866fa73cc454486a84e73b3ba7ae
Author: Tomas Popela <tpopela redhat com>
Date: Mon Nov 23 13:49:50 2015 +0100
EHTMLEditorView - Check if the Backspace or Delete operation can remove anything
Do it before we try to save history for these operations, otherwise a warning
will be printed on console.
e-util/e-html-editor-view.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index ac16f55..73e4f30 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -4257,6 +4257,26 @@ save_history_for_delete_or_backspace (EHTMLEditorView *view,
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 (view, range)) {
g_object_unref (range);
g_object_unref (dom_selection);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]