aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Popela <tpopela@redhat.com>2014-09-12 16:09:11 +0800
committerTomas Popela <tpopela@redhat.com>2014-09-12 16:23:26 +0800
commit8fce678d4801870d69d6d37604885c4b81c69266 (patch)
tree0a0316f7e308e4a1e62caef1e7a78d445362cfb3
parentfd226bf07d20e124a3e498f1b0776a5341aa93ce (diff)
downloadgsoc2013-evolution-8fce678d4801870d69d6d37604885c4b81c69266.tar
gsoc2013-evolution-8fce678d4801870d69d6d37604885c4b81c69266.tar.gz
gsoc2013-evolution-8fce678d4801870d69d6d37604885c4b81c69266.tar.bz2
gsoc2013-evolution-8fce678d4801870d69d6d37604885c4b81c69266.tar.lz
gsoc2013-evolution-8fce678d4801870d69d6d37604885c4b81c69266.tar.xz
gsoc2013-evolution-8fce678d4801870d69d6d37604885c4b81c69266.tar.zst
gsoc2013-evolution-8fce678d4801870d69d6d37604885c4b81c69266.zip
Bug 736476 - Space lost on the end of linemaster
Again this had something to do with WebKit behavior regarding to the DOM selection. The thing is that when the selection is saved and afterwards restored on the same position it is not restored on the same position. So we hav to determine if we are writing into the quoted text differently without saving the selection.
-rw-r--r--e-util/e-html-editor-view.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index 58b23bde4d..27652796e0 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -775,7 +775,7 @@ body_input_event_cb (WebKitDOMElement *element,
/* After toggling monospaced format, we are using UNICODE_ZERO_WIDTH_SPACE
* to move caret into right space. When this callback is called it is not
* necassary anymore so remove it */
- if (e_html_editor_view_get_html_mode (view)) {
+ if (view->priv->html_mode) {
WebKitDOMElement *parent = webkit_dom_node_get_parent_element (node);
if (parent) {
@@ -860,26 +860,32 @@ body_input_event_cb (WebKitDOMElement *element,
/* Writing into quoted content */
if (!view->priv->html_mode) {
- gint citation_level, length, word_wrap_length;
+ gint citation_level;
EHTMLEditorSelection *selection;
- WebKitDOMElement *element;
WebKitDOMDocument *document;
- WebKitDOMNode *parent;
+ WebKitDOMElement *element;
+ WebKitDOMNode *node, *parent;
+ WebKitDOMRange *range;
- document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (view));
+ range = html_editor_view_get_dom_range (view);
+ node = webkit_dom_range_get_end_container (range, NULL);
- selection = e_html_editor_view_get_selection (view);
- word_wrap_length = e_html_editor_selection_get_word_wrap_length (selection);
+ citation_level = get_citation_level (node, FALSE);
+ if (citation_level == 0)
+ return;
+
+ document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (view));
element = webkit_dom_document_query_selector (
document, "span#-x-evo-selection-start-marker", NULL);
if (element)
return;
+ selection = e_html_editor_view_get_selection (view);
e_html_editor_selection_save (selection);
+
element = webkit_dom_document_query_selector (
document, "span#-x-evo-selection-start-marker", NULL);
-
/* If the selection was not saved, move it into the first child of body */
if (!element) {
WebKitDOMHTMLElement *body;
@@ -916,15 +922,16 @@ body_input_event_cb (WebKitDOMElement *element,
return;
}
- citation_level = get_citation_level (WEBKIT_DOM_NODE (element), FALSE);
- length = word_wrap_length - 2 * citation_level;
-
- if (element && citation_level > 0) {
+ if (element) {
gchar *content;
- gint text_length;
+ gint text_length, word_wrap_length, length;
WebKitDOMElement *block;
gboolean remove_quoting = FALSE;
+ word_wrap_length =
+ e_html_editor_selection_get_word_wrap_length (selection);
+ length = word_wrap_length - 2 * citation_level;
+
block = WEBKIT_DOM_ELEMENT (parent);
if (webkit_dom_element_query_selector (
WEBKIT_DOM_ELEMENT (block), ".-x-evo-quoted", NULL)) {