[evolution] History could be saved twice if inserting HTML content
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] History could be saved twice if inserting HTML content
- Date: Fri, 10 Mar 2017 11:41:53 +0000 (UTC)
commit 6e32a891e879695302f2caa63aa6b677a2b3eb98
Author: Tomas Popela <tpopela redhat com>
Date: Thu Mar 9 12:01:08 2017 +0100
History could be saved twice if inserting HTML content
.../web-extension/e-editor-dom-functions.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
b/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
index ec75482..c840194 100644
--- a/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
+++ b/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
@@ -8836,7 +8836,7 @@ e_editor_dom_insert_html (EEditorPage *editor_page,
{
EEditorHistoryEvent *ev = NULL;
EEditorUndoRedoManager *manager;
- gboolean html_mode;
+ gboolean html_mode, undo_redo_in_progress;
WebKitDOMDocument *document;
WebKitDOMNode *block = NULL;
@@ -8846,7 +8846,8 @@ e_editor_dom_insert_html (EEditorPage *editor_page,
document = e_editor_page_get_document (editor_page);
manager = e_editor_page_get_undo_redo_manager (editor_page);
- if (!e_editor_undo_redo_manager_is_operation_in_progress (manager)) {
+ undo_redo_in_progress = e_editor_undo_redo_manager_is_operation_in_progress (manager);
+ if (!undo_redo_in_progress) {
gboolean collapsed;
ev = g_new0 (EEditorHistoryEvent, 1);
@@ -8972,8 +8973,14 @@ e_editor_dom_insert_html (EEditorPage *editor_page,
e_editor_dom_check_magic_links (editor_page, FALSE);
e_editor_dom_scroll_to_caret (editor_page);
e_editor_dom_force_spell_check_in_viewport (editor_page);
- } else
+ } else {
+ /* Don't save history in the underlying function. */
+ if (!undo_redo_in_progress)
+ e_editor_undo_redo_manager_set_operation_in_progress (manager, TRUE);
e_editor_dom_convert_and_insert_html_into_selection (editor_page, html_text, TRUE);
+ if (!undo_redo_in_progress)
+ e_editor_undo_redo_manager_set_operation_in_progress (manager, FALSE);
+ }
remove_apple_interchange_newline_elements (document);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]