[evolution] Bug 736476 - Space lost on the end of line
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Bug 736476 - Space lost on the end of line
- Date: Fri, 12 Sep 2014 08:24:49 +0000 (UTC)
commit 8fce678d4801870d69d6d37604885c4b81c69266
Author: Tomas Popela <tpopela redhat com>
Date: Fri Sep 12 10:09:11 2014 +0200
Bug 736476 - Space lost on the end of line
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.
e-util/e-html-editor-view.c | 33 ++++++++++++++++++++-------------
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 58b23bd..2765279 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)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]