[evolution] EHTMLEditorSelection - Avoid wrong wrapping in some cases
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] EHTMLEditorSelection - Avoid wrong wrapping in some cases
- Date: Fri, 4 Sep 2015 11:47:26 +0000 (UTC)
commit 968b58f6cc68af990037a7f3602a0263b4f3f81f
Author: Tomas Popela <tpopela redhat com>
Date: Fri Sep 4 11:11:56 2015 +0200
EHTMLEditorSelection - Avoid wrong wrapping in some cases
If the length of the current node is the same as length of the current line
wrap before the current node and continue with the same node.
e-util/e-html-editor-selection.c | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/e-util/e-html-editor-selection.c b/e-util/e-html-editor-selection.c
index 2a924dd..6839575 100644
--- a/e-util/e-html-editor-selection.c
+++ b/e-util/e-html-editor-selection.c
@@ -6500,9 +6500,22 @@ wrap_lines (EHTMLEditorSelection *selection,
while (node && (length_left + line_length) > length_to_wrap) {
gint max_length;
+ element = webkit_dom_document_create_element (document, "BR", NULL);
+ element_add_class (element, "-x-evo-wrap-br");
+
max_length = length_to_wrap - line_length;
if (max_length < 0)
max_length = length_to_wrap;
+ else if (max_length == 0) {
+ /* Break before the current node and continue. */
+ webkit_dom_node_insert_before (
+ webkit_dom_node_get_parent_node (node),
+ WEBKIT_DOM_NODE (element),
+ node,
+ NULL);
+ line_length = 0;
+ continue;
+ }
/* Allow anchors to break on any character. */
if (g_object_get_data (G_OBJECT (node), "-x-evo-anchor-text"))
@@ -6514,9 +6527,6 @@ wrap_lines (EHTMLEditorSelection *selection,
WEBKIT_DOM_CHARACTER_DATA (node), max_length);
}
- element = webkit_dom_document_create_element (document, "BR", NULL);
- element_add_class (element, "-x-evo-wrap-br");
-
if (offset > 0) {
WebKitDOMNode *nd;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]