[evolution/gnome-3-16] EHTMLEditorSelection - Blocks are wrongly wrapped when the last character is space
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/gnome-3-16] EHTMLEditorSelection - Blocks are wrongly wrapped when the last character is space
- Date: Wed, 24 Jun 2015 06:41:48 +0000 (UTC)
commit b09894e3955f6f8c9cde8c420b06199df14c0d2e
Author: Tomas Popela <tpopela redhat com>
Date: Tue Jun 23 16:01:25 2015 +0200
EHTMLEditorSelection - Blocks are wrongly wrapped when the last character is space
Only insert the wrap elements if there is actually something to wrap.
e-util/e-html-editor-selection.c | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/e-util/e-html-editor-selection.c b/e-util/e-html-editor-selection.c
index fe2efb5..b421c0f 100644
--- a/e-util/e-html-editor-selection.c
+++ b/e-util/e-html-editor-selection.c
@@ -6346,20 +6346,22 @@ wrap_lines (EHTMLEditorSelection *selection,
mark_and_remove_leading_space (document, nd);
g_free (nd_content);
nd_content = webkit_dom_node_get_text_content (nd);
- if (g_strcmp0 (nd_content, UNICODE_NBSP) == 0)
+ if (g_strcmp0 (nd_content, UNICODE_NBSP) == 0 || !*nd_content)
remove_node (nd);
g_free (nd_content);
}
- webkit_dom_node_insert_before (
- webkit_dom_node_get_parent_node (node),
- WEBKIT_DOM_NODE (element),
- nd,
- NULL);
+ if (nd) {
+ webkit_dom_node_insert_before (
+ webkit_dom_node_get_parent_node (node),
+ WEBKIT_DOM_NODE (element),
+ nd,
+ NULL);
- node = webkit_dom_node_get_next_sibling (
- WEBKIT_DOM_NODE (element));
- offset = 0;
+ node = webkit_dom_node_get_next_sibling (
+ WEBKIT_DOM_NODE (element));
+ offset = 0;
+ }
} else {
webkit_dom_node_append_child (
webkit_dom_node_get_parent_node (node),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]