[evolution/gnome-3-18] Bug 756218 - Current selection could be lost during autosave
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/gnome-3-18] Bug 756218 - Current selection could be lost during autosave
- Date: Thu, 8 Oct 2015 08:33:23 +0000 (UTC)
commit 072fceacd1ca14d9748dd35272ed277986810780
Author: Tomas Popela <tpopela redhat com>
Date: Thu Oct 8 10:28:20 2015 +0200
Bug 756218 - Current selection could be lost during autosave
If the selection is already saved don't try to save it again as it could
be lost.
composer/e-msg-composer.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 533211b..855cf04 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -1233,14 +1233,17 @@ composer_build_message (EMsgComposer *composer,
}
if (flags & COMPOSER_FLAG_SAVE_DRAFT) {
+ gboolean selection_saved = FALSE;
gchar *text;
EHTMLEditor *editor;
EHTMLEditorView *view;
EHTMLEditorSelection *selection;
+ WebKitDOMDocument *document;
editor = e_msg_composer_get_editor (composer);
view = e_html_editor_get_view (editor);
selection = e_html_editor_view_get_selection (view);
+ document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (view));
/* X-Evolution-Format */
composer_add_evolution_format_header (
@@ -1253,7 +1256,10 @@ composer_build_message (EMsgComposer *composer,
data = g_byte_array_new ();
e_html_editor_view_embed_styles (view);
- e_html_editor_selection_save (selection);
+ selection_saved = webkit_dom_document_get_element_by_id (
+ document, "-x-evo-selection-start-marker") != NULL;
+ if (!selection_saved)
+ e_html_editor_selection_save (selection);
text = e_html_editor_view_get_text_html_for_drafts (view);
@@ -1261,6 +1267,9 @@ composer_build_message (EMsgComposer *composer,
e_html_editor_selection_restore (selection);
e_html_editor_view_force_spell_check_in_viewport (view);
+ if (selection_saved)
+ e_html_editor_selection_save (selection);
+
g_byte_array_append (data, (guint8 *) text, strlen (text));
g_free (text);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]