Fix B2014-003: parsing of rtf was incorrect for link with symbol and text after link

This commit is contained in:
Kathy Ruffing 2014-01-23 14:25:12 +00:00
parent a2e9b0b66a
commit fff0233bf3

View File

@ -1308,17 +1308,22 @@ namespace Volian.Controls.Library
// Find the 'end comment' for this <START], can't count characters
// because there may be formatting characters such as \b or \ul before
// the \v0
int startAdj = 4;
int linkIndx = text.IndexOf(@"#Link", index);
int endStartTknIndx = text.IndexOf(@"\v0 ", index);
if (endStartTknIndx == -1)
endStartTknIndx = text.IndexOf(@"\v0", index);
int endStartTknIndxNoSpace = text.IndexOf(@"\v0", index);
if (endStartTknIndx == -1 || endStartTknIndxNoSpace < endStartTknIndx)
{
endStartTknIndx = endStartTknIndxNoSpace;
startAdj = 3;
}
int endTextIndx = text.IndexOf(@"\v ", endStartTknIndx); // find end of text
if (endTextIndx == -1)
endTextIndx = text.IndexOf(@"\v", endStartTknIndx);
int endTextIndx2 = text.IndexOf(@"\v\up0 ", endStartTknIndx); // find end of text
if(endTextIndx2 > 0 && (endTextIndx < 0 || endTextIndx > endTextIndx2))
endTextIndx = endTextIndx2;
vte.Text = text.Substring(endStartTknIndx + 4, endTextIndx - endStartTknIndx - 4); // 4 for \v0
endTextIndx = endTextIndx2;
vte.Text = text.Substring(endStartTknIndx + startAdj, endTextIndx - endStartTknIndx - startAdj); // 4 for \v0
// Now get the link part. It can be terminated by a '\v0' or an [END>
int endLinkIndxV = text.IndexOf(@"\v0 ", linkIndx);