From 51a5e90fd9b3961f07997909369b12ef5979ad5c Mon Sep 17 00:00:00 2001 From: Tomas Popela Date: Mon, 30 Jun 2014 14:26:21 +0200 Subject: EHTMLEditorSelection - Fix wrapping of the anchor elements When there is a whitespace after the link leave it after the link and don't try to wrap before it. --- e-util/e-html-editor-selection.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/e-util/e-html-editor-selection.c b/e-util/e-html-editor-selection.c index 938a06dc87..87138dc075 100644 --- a/e-util/e-html-editor-selection.c +++ b/e-util/e-html-editor-selection.c @@ -4676,7 +4676,7 @@ find_where_to_break_line (WebKitDOMNode *node, if ((pos > max_len) && (last_space > 0)) { if (last_space > word_wrap_length) { g_free (text_start); - return last_space; + return last_space - 1; } if (last_space > max_len) { @@ -4883,7 +4883,17 @@ wrap_lines (EHTMLEditorSelection *selection, len += anchor_length; g_free (text_content); + /* If there is space after the anchor don't try to + * wrap before it */ node = webkit_dom_node_get_next_sibling (node); + if (WEBKIT_DOM_IS_TEXT (node)) { + text_content = webkit_dom_node_get_text_content (node); + if (g_strcmp0 (text_content, " ") == 0) { + node = webkit_dom_node_get_next_sibling (node); + len++; + } + g_free (text_content); + } continue; } -- cgit v1.2.3