[evolution/wip/webkit-composer: 497/966] EEditorWidget: Try to remove UNICODE_ZERO_WIDTH_SPACE just when there is 1+ characters
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit-composer: 497/966] EEditorWidget: Try to remove UNICODE_ZERO_WIDTH_SPACE just when there is 1+ characters
- Date: Wed, 23 Apr 2014 10:35:12 +0000 (UTC)
commit 034f19999ced56ba748cb0b2d5b590f1ce792caa
Author: Tomas Popela <tpopela redhat com>
Date: Thu Jan 30 11:50:03 2014 +0100
EEditorWidget: Try to remove UNICODE_ZERO_WIDTH_SPACE just when there is 1+ characters
e-util/e-editor-widget.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/e-util/e-editor-widget.c b/e-util/e-editor-widget.c
index 2394ead..e328dae 100644
--- a/e-util/e-editor-widget.c
+++ b/e-util/e-editor-widget.c
@@ -315,11 +315,13 @@ body_input_event_cb (WebKitDOMElement *element,
node = webkit_dom_range_get_end_container (range, NULL);
if (WEBKIT_DOM_IS_TEXT (node)) {
gchar *text = webkit_dom_node_get_text_content (node);
- if (strstr (text, UNICODE_ZERO_WIDTH_SPACE)) {
+ glong length = g_utf8_strlen (text, -1);
+ /* We have to preserve empty paragraphs with just UNICODE_ZERO_WIDTH_SPACE
+ * character as when we will remove it it will collapse */
+ if (length > 1 && strstr (text, UNICODE_ZERO_WIDTH_SPACE)) {
WebKitDOMDocument *document;
WebKitDOMDOMWindow *window;
WebKitDOMDOMSelection *selection;
-
GString *res = e_str_replace_string (text, UNICODE_ZERO_WIDTH_SPACE, "");
webkit_dom_node_set_text_content (node, res->str, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]