[evolution/wip/webkit-composer: 724/966] Remove temporary hidden space character even on lines, that have less characters than word_wrap_leng



commit c11b66cc5964eef59b59bf7664a93657d0df2f64
Author: Tomas Popela <tpopela redhat com>
Date:   Fri Jul 12 14:26:37 2013 +0200

    Remove temporary hidden space character even on lines, that have less characters than word_wrap_length.

 e-util/e-editor-selection.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/e-util/e-editor-selection.c b/e-util/e-editor-selection.c
index 76397ba..644698a 100644
--- a/e-util/e-editor-selection.c
+++ b/e-util/e-editor-selection.c
@@ -3128,6 +3128,26 @@ e_editor_selection_wrap_lines (EEditorSelection *selection,
 
                webkit_dom_html_element_set_id (WEBKIT_DOM_HTML_ELEMENT (paragraph), 
"-x-evo-active-paragraph");
 
+               /* If there is hidden space character in the beginning we remove it */
+               if (strstr (webkit_dom_node_get_text_content (paragraph), UNICODE_HIDDEN_SPACE)) {
+                       WebKitDOMNode *child = webkit_dom_node_get_first_child (paragraph);
+                       GRegex *regex;
+                       gchar *node_text;
+
+                       regex = g_regex_new (UNICODE_HIDDEN_SPACE, 0, 0, NULL);
+                       if (!regex)
+                               return;
+
+                       node_text = webkit_dom_character_data_get_data (WEBKIT_DOM_CHARACTER_DATA (child));
+                       webkit_dom_character_data_set_data (
+                               WEBKIT_DOM_CHARACTER_DATA (child),
+                               g_regex_replace_literal (regex, node_text, -1, 0, "", 0, NULL),
+                               NULL);
+
+                       g_free (node_text);
+                       g_regex_unref (regex);
+               }
+
                if (previously_wrapped) {
                        /* If we are on the beginning of line we need to remember it */
                        if (!adding && start_offset > selection->priv->word_wrap_length)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]