From be18f431c7759dbdceb2aaf43038bde0f6002677 Mon Sep 17 00:00:00 2001 From: gambas Date: Fri, 18 Dec 2020 02:57:12 +0100 Subject: [PATCH] Fixes in rich text to pango markup conversion. [GB.GTK] * NEW: Replace '' by '' in rich text. * BUG: '

' in rich text is replaced by a single line break. [GB.GTK3] * NEW: Replace '' by '' in rich text. * BUG: '

' in rich text is replaced by a single line break. --- gb.gtk/src/gtools.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gb.gtk/src/gtools.cpp b/gb.gtk/src/gtools.cpp index d3bc94448..7373b6931 100644 --- a/gb.gtk/src/gtools.cpp +++ b/gb.gtk/src/gtools.cpp @@ -1053,7 +1053,7 @@ char *gt_html_to_pango_string(const char *html, int len_html, bool newline_are_b { if ((end_token || inside_par) && p[1]) { - g_string_append(pango, "\n\n"); + g_string_append(pango, "\n"); newline = true; } inside_par = start_token; @@ -1135,6 +1135,15 @@ char *gt_html_to_pango_string(const char *html, int len_html, bool newline_are_b goto __FOUND_TOKEN; } + if (!strcasecmp(token, "code")) + { + if (start_token && !end_token) + g_string_append(pango, ""); + else if (end_token && !start_token) + g_string_append(pango, ""); + goto __FOUND_TOKEN; + } + g_string_append(pango, "<"); if (end_token) g_string_append(pango, "/"); while (p_markup < p)