[evolution] EHTMLEditorView - When the link has non-breaking space in the prefix skip it



commit 85ceca17e61b29385a4332e1547f5f8861bdf502
Author: Tomas Popela <tpopela redhat com>
Date:   Mon Jul 21 16:59:10 2014 +0200

    EHTMLEditorView - When the link has non-breaking space in the prefix skip it

 e-util/e-html-editor-view.c |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)
---
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index 0432a01..5956439 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -3430,6 +3430,7 @@ create_anchor_for_link (const GMatchInfo *info,
                         GString *res,
                         gpointer data)
 {
+       gint offset = 0;
        gchar *match;
        gboolean address_surrounded;
 
@@ -3441,27 +3442,29 @@ create_anchor_for_link (const GMatchInfo *info,
                g_str_has_suffix (match, "&gt;");
 
        if (address_surrounded)
+               offset += 4;
+
+       if (g_str_has_prefix (match, "&nbsp;"))
+               offset += 6;
+
+       if (address_surrounded)
                g_string_append (res, "&lt;");
 
        g_string_append (res, "<a href=\"");
        if (strstr (match, "@")) {
                g_string_append (res, "mailto:";);
-               if (address_surrounded) {
-                       g_string_append (res, match + 4);
+               g_string_append (res, match + offset);
+               if (address_surrounded)
                        g_string_truncate (res, res->len - 4);
-               } else
-                       g_string_append (res, match);
 
                g_string_append (res, "\">");
-               if (address_surrounded) {
-                       g_string_append (res, match + 4);
+               g_string_append (res, match + offset);
+               if (address_surrounded)
                        g_string_truncate (res, res->len - 4);
-               } else
-                       g_string_append (res, match);
        } else {
-               g_string_append (res, match);
+               g_string_append (res, match + offset);
                g_string_append (res, "\">");
-               g_string_append (res, match);
+               g_string_append (res, match + offset);
        }
        g_string_append (res, "</a>");
 


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