From 08485f67812974c3ff2eb8daa08508de1188f72b Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Wed, 5 Jun 2024 20:11:47 +0200 Subject: [PATCH] Chat: Remove tailing punctuation from clickable links --- src/chat.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/chat.cpp b/src/chat.cpp index 5331a87bd..ec84d125f 100644 --- a/src/chat.cpp +++ b/src/chat.cpp @@ -376,6 +376,13 @@ u32 ChatBuffer::formatChatLine(const ChatLine &line, u32 cols, tempchar = linestring[in_pos+frag_length]; } + // Remove tailing punctuation characters + static const std::wstring tailing_chars = L",."; + tempchar = linestring[in_pos+frag_length - 1]; + if (tailing_chars.find(tempchar) != std::wstring::npos) { + frag_length--; + } + space_pos = frag_length - 1; // This frag may need to be force-split. That's ok, urls aren't "words" if (frag_length >= remaining_in_output) {