From 85ceca17e61b29385a4332e1547f5f8861bdf502 Mon Sep 17 00:00:00 2001 From: Tomas Popela Date: Mon, 21 Jul 2014 16:59:10 +0200 Subject: EHTMLEditorView - When the link has non-breaking space in the prefix skip it --- e-util/e-html-editor-view.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c index 0432a01426..5956439f1e 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; @@ -3440,28 +3441,30 @@ create_anchor_for_link (const GMatchInfo *info, g_str_has_prefix (match, "<") && g_str_has_suffix (match, ">"); + if (address_surrounded) + offset += 4; + + if (g_str_has_prefix (match, " ")) + offset += 6; + if (address_surrounded) g_string_append (res, "<"); g_string_append (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, ""); -- cgit v1.2.3