From 5e33d7ec2ac1986b094fbe692065ef3f709d0b59 Mon Sep 17 00:00:00 2001 From: Rich Date: Tue, 21 Oct 2014 04:43:55 +0000 Subject: [PATCH] Fix ReplaceWords so that it doesn't replace link tokens. --- PROMS/Volian.Controls.Library/DisplayText.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/PROMS/Volian.Controls.Library/DisplayText.cs b/PROMS/Volian.Controls.Library/DisplayText.cs index 61860bbd..a88b4ce8 100644 --- a/PROMS/Volian.Controls.Library/DisplayText.cs +++ b/PROMS/Volian.Controls.Library/DisplayText.cs @@ -1973,7 +1973,7 @@ namespace Volian.Controls.Library { if (foundMatch.MyWord != null) { - if (VerifyNoHardSpace(text, foundMatch, offset)) + if (VerifyNoHardSpace(text, foundMatch, offset) && VerifyNoLink(text, foundMatch, offset)) { //if(offset != 0 || foundMatch.MyMatch.Index != 0 || !foundMatch.MyWord.ReplaceWith.StartsWith(@"{\par}")) //{ @@ -2033,6 +2033,14 @@ namespace Volian.Controls.Library } return text; } + private bool VerifyNoLink(string text, FoundMatch fndMatch, int offset) + { + if (text.Substring(offset + fndMatch.MyMatch.Index, fndMatch.MyMatch.Length) == "START") + if (fndMatch.MyMatch.Index > 0 && offset + fndMatch.MyMatch.Index + fndMatch.MyMatch.Length < text.Length && + text.Substring(offset + fndMatch.MyMatch.Index - 1, fndMatch.MyMatch.Length + 2) == "