This commit is contained in:
@@ -400,7 +400,7 @@ namespace Volian.Controls.Library
|
||||
private string DoTransitionAdjustments(string text, bool boldTran)
|
||||
{
|
||||
string strippedText = StaticStripRtfCommands(text);
|
||||
string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* (.*?)(\\[^v \\]+)*\\v(\\[^v \\]+)* #Link:(ReferencedObject|Transition[^:]*?):[0-9]* ([0-9]*).*?\[END>");
|
||||
string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* (.*?)(\\[^v \\u]+)*\\v(\\[^v \\]+)* #Link:(ReferencedObject|Transition[^:]*?):[0-9]* ([0-9]*).*?\[END>");
|
||||
MatchCollection matches = Regex.Matches(text, lookFor);
|
||||
if (matches.Count == 0) return text;
|
||||
string retstr = text;
|
||||
@@ -413,7 +413,7 @@ namespace Volian.Controls.Library
|
||||
//if (!Char.IsDigit(m.Groups[3].Value[0])) continue;
|
||||
if (m != null && m.Groups.Count > 7 && m.Groups[6].ToString().StartsWith("Transition"))
|
||||
{
|
||||
if (m.Groups[7].Value != "" && StepTransition(int.Parse(m.Groups[7].Value)))
|
||||
if (m.Groups[7].Value != "") // && StepTransition(int.Parse(m.Groups[7].Value)))
|
||||
{
|
||||
System.Text.RegularExpressions.Group g = m.Groups[3];
|
||||
string beforeTran = retstr.Substring(0, g.Index);
|
||||
@@ -423,19 +423,27 @@ namespace Volian.Controls.Library
|
||||
// i.e. there is a format flag 'BeforeTrans' that bolds text before the transition
|
||||
// (in wst formats).
|
||||
beforeTran = DoBeforeTransFlagSupport(beforeTran, _MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.ReplaceStrList);
|
||||
|
||||
string newvalue = g.ToString();
|
||||
int indexLastSpace = newvalue.LastIndexOf(' ');
|
||||
if (indexLastSpace >= 0)
|
||||
// Use a "\x1" as a token to replace later. Insert the unicode char, whose length is
|
||||
// more than 1 character was throwing of the regexp Matches index, so that the resulting
|
||||
// string may have been incorrect.
|
||||
retstr = beforeTran + (boldTran ? @"\b " : null) + newvalue.Substring(0, indexLastSpace) + "\x1" + newvalue.Substring(indexLastSpace + 1) + (boldTran ? @"\b0" : null) + afterTran;
|
||||
else
|
||||
if (beforeTran.EndsWith(" ") )
|
||||
retstr = ReplaceLastSpaceWithHardSpace(beforeTran) + (boldTran ? @"\b " : null) + newvalue + (boldTran ? @"\b0" : null) + afterTran;
|
||||
// if this is a 'step transition' type, i.e. includes a step number, in addition to other replacements,
|
||||
// we want to change a space to a hardspace.
|
||||
if (StepTransition(int.Parse(m.Groups[7].Value)))
|
||||
{
|
||||
int indexLastSpace = newvalue.LastIndexOf(' ');
|
||||
if (indexLastSpace >= 0)
|
||||
// Use a "\x1" as a token to replace later. Insert the unicode char, whose length is
|
||||
// more than 1 character was throwing of the regexp Matches index, so that the resulting
|
||||
// string may have been incorrect.
|
||||
retstr = beforeTran + (boldTran ? @"\b " : null) + newvalue.Substring(0, indexLastSpace) + "\x1" + newvalue.Substring(indexLastSpace + 1) + (boldTran ? @"\b0" : null) + afterTran;
|
||||
else
|
||||
Console.Write("");// Don't know where to put the Hard Space
|
||||
if (beforeTran.EndsWith(" "))
|
||||
retstr = ReplaceLastSpaceWithHardSpace(beforeTran) + (boldTran ? @"\b " : null) + newvalue + (boldTran ? @"\b0" : null) + afterTran;
|
||||
else
|
||||
Console.Write("");// Don't know where to put the Hard Space
|
||||
}
|
||||
else if (boldTran)
|
||||
{
|
||||
retstr = beforeTran + @"\b " + newvalue + @"\b0" + afterTran;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user