Fix B2014-003: parsing of rtf was incorrect for link with symbol and text after link
This commit is contained in:
parent
a2e9b0b66a
commit
fff0233bf3
@ -1308,17 +1308,22 @@ namespace Volian.Controls.Library
|
|||||||
// Find the 'end comment' for this <START], can't count characters
|
// Find the 'end comment' for this <START], can't count characters
|
||||||
// because there may be formatting characters such as \b or \ul before
|
// because there may be formatting characters such as \b or \ul before
|
||||||
// the \v0
|
// the \v0
|
||||||
|
int startAdj = 4;
|
||||||
int linkIndx = text.IndexOf(@"#Link", index);
|
int linkIndx = text.IndexOf(@"#Link", index);
|
||||||
int endStartTknIndx = text.IndexOf(@"\v0 ", index);
|
int endStartTknIndx = text.IndexOf(@"\v0 ", index);
|
||||||
if (endStartTknIndx == -1)
|
int endStartTknIndxNoSpace = text.IndexOf(@"\v0", index);
|
||||||
endStartTknIndx = text.IndexOf(@"\v0", index);
|
if (endStartTknIndx == -1 || endStartTknIndxNoSpace < endStartTknIndx)
|
||||||
|
{
|
||||||
|
endStartTknIndx = endStartTknIndxNoSpace;
|
||||||
|
startAdj = 3;
|
||||||
|
}
|
||||||
int endTextIndx = text.IndexOf(@"\v ", endStartTknIndx); // find end of text
|
int endTextIndx = text.IndexOf(@"\v ", endStartTknIndx); // find end of text
|
||||||
if (endTextIndx == -1)
|
if (endTextIndx == -1)
|
||||||
endTextIndx = text.IndexOf(@"\v", endStartTknIndx);
|
endTextIndx = text.IndexOf(@"\v", endStartTknIndx);
|
||||||
int endTextIndx2 = text.IndexOf(@"\v\up0 ", endStartTknIndx); // find end of text
|
int endTextIndx2 = text.IndexOf(@"\v\up0 ", endStartTknIndx); // find end of text
|
||||||
if(endTextIndx2 > 0 && (endTextIndx < 0 || endTextIndx > endTextIndx2))
|
if(endTextIndx2 > 0 && (endTextIndx < 0 || endTextIndx > endTextIndx2))
|
||||||
endTextIndx = endTextIndx2;
|
endTextIndx = endTextIndx2;
|
||||||
vte.Text = text.Substring(endStartTknIndx + 4, endTextIndx - endStartTknIndx - 4); // 4 for \v0
|
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>
|
// Now get the link part. It can be terminated by a '\v0' or an [END>
|
||||||
int endLinkIndxV = text.IndexOf(@"\v0 ", linkIndx);
|
int endLinkIndxV = text.IndexOf(@"\v0 ", linkIndx);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user