From 47c88c433d17948fab1d8e1d76121a72fe5938cb Mon Sep 17 00:00:00 2001 From: "B. Stack" Date: Wed, 7 Sep 2022 14:49:22 -0400 Subject: add upstream 11.24 --- wx+/no_flicker.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'wx+/no_flicker.h') diff --git a/wx+/no_flicker.h b/wx+/no_flicker.h index d8f2d6cd..7fa4ae23 100644 --- a/wx+/no_flicker.h +++ b/wx+/no_flicker.h @@ -85,20 +85,26 @@ void setTextWithUrls(wxRichTextCtrl& richCtrl, const wxString& newText) urlStyle.SetTextColour(*wxBLUE); urlStyle.SetFontUnderlined(true); - for (const auto& [type, text] : blocks) + for (auto& [type, text] : blocks) switch (type) { case BlockType::text: + if (endsWith(text, L"\n\n")) //bug: multiple newlines before a URL are condensed to only one; + //Why? fuck knows why! no such issue with double newlines *after* URL => hack this shit + text.RemoveLast().Append(ZERO_WIDTH_SPACE).Append(L'\n'); + richCtrl.WriteText(text); break; case BlockType::url: + { richCtrl.BeginStyle(urlStyle); ZEN_ON_SCOPE_EXIT(richCtrl.EndStyle()); richCtrl.BeginURL(text); ZEN_ON_SCOPE_EXIT(richCtrl.EndURL()); richCtrl.WriteText(text); - break; + } + break; } if (std::any_of(blocks.begin(), blocks.end(), [](const auto& item) { return item.first == BlockType::url; })) -- cgit