[evolution] 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] EHTMLEditorView - Check if the Backspace or Delete operation can remove anything
- Date: Mon, 23 Nov 2015 12:51:24 +0000 (UTC)
commit 3bb9fe6738671ecc680d883d0f9ba0738210a055
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 a1619ef..1190310 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -4266,6 +4266,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]