Fix ReplaceWords so that it doesn't replace link tokens.
This commit is contained in:
parent
f50fda89ff
commit
5e33d7ec2a
@ -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) == "<START]")
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
internal static bool DiffUnit(string unit,ItemInfo myItemInfo,string prefix)
|
||||
{
|
||||
if (unit.StartsWith(prefix))
|
||||
|
Loading…
x
Reference in New Issue
Block a user