summaryrefslogtreecommitdiff
path: root/wx+/no_flicker.h
diff options
context:
space:
mode:
Diffstat (limited to 'wx+/no_flicker.h')
-rw-r--r--wx+/no_flicker.h10
1 files changed, 8 insertions, 2 deletions
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; }))
bgstack15