From fd80feab2090e9c1dd03e04c4cc400b5cf133b89 Mon Sep 17 00:00:00 2001 From: Benedikt Constantin Radtke Date: Mon, 9 Jul 2018 11:45:20 +0200 Subject: [PATCH] Fix text disruption if it contains "invalid" urls fixes #186 --- Signal-Windows/Controls/Message.xaml.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Signal-Windows/Controls/Message.xaml.cs b/Signal-Windows/Controls/Message.xaml.cs index 5135dc3..a282cc5 100644 --- a/Signal-Windows/Controls/Message.xaml.cs +++ b/Signal-Windows/Controls/Message.xaml.cs @@ -167,13 +167,20 @@ private void UpdateMessageTextBlock() } catch (Exception) { + MessageContentTextBlock.Inlines.Add(new Run() + { + Text = link + }); continue; } + finally + { + previousIndex = currentIndex + match.Length; + currentIndex = previousIndex; + } hyperlink.UnderlineStyle = UnderlineStyle.Single; hyperlink.Inlines.Add(hyperlinkRun); MessageContentTextBlock.Inlines.Add(hyperlink); - previousIndex = currentIndex + match.Length; - currentIndex = previousIndex; } // Then finish up by adding the rest of the message text to the TextBox