[evolution/wip/webkit-composer] EEditorWidget: Fix parsing of html text into paragraphs



commit f94d9506fd64b0d61b211f353186f9f6098ff955
Author: Tomas Popela <tpopela redhat com>
Date:   Thu Mar 13 14:37:59 2014 +0100

    EEditorWidget: Fix parsing of html text into paragraphs
    
    Sometimes there could be spaces before the BR element.

 e-util/e-editor-widget.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/e-util/e-editor-widget.c b/e-util/e-editor-widget.c
index 5f54a69..16797be 100644
--- a/e-util/e-editor-widget.c
+++ b/e-util/e-editor-widget.c
@@ -2194,15 +2194,15 @@ parse_html_into_paragraphs (EEditorWidget *widget,
        next_br = strstr (prev_br, "<br>");
 
        while (next_br) {
-               gboolean with_br = FALSE;
-               const gchar *citation = NULL, *citation_end = NULL, *rest = NULL;
+               const gchar *citation = NULL, *citation_end = NULL;
+               const gchar *rest = NULL, *with_br = NULL;
                gchar *to_insert = NULL;
                WebKitDOMElement *paragraph;
 
                to_insert = g_utf8_substring (
                        prev_br, 0, g_utf8_pointer_to_offset (prev_br, next_br));
 
-               with_br = g_str_has_prefix (to_insert, "<br>");
+               with_br = strstr (to_insert, "<br>");
 
                citation = strstr (to_insert, "##CITATION_");
                if (citation) {
@@ -2215,7 +2215,8 @@ parse_html_into_paragraphs (EEditorWidget *widget,
                        if (citation_end)
                                rest = citation_end + 2;
                } else {
-                       rest = with_br ? to_insert + 4 : to_insert;
+                       rest = with_br ?
+                               to_insert + 4 + (with_br - to_insert) : to_insert;
                }
 
                if (use_pre || citation_level > 0) {


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