When there is a bold and underline command remove the space between the two commands.
Logic to consider underline and bold command between a hard space a word when determining if replace words should be done.
This commit is contained in:
@@ -1778,14 +1778,12 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
private string DoReplaceWords2(string Text)
|
||||
{
|
||||
if(!ProcessReplaceWords) return Text;
|
||||
if (!ProcessReplaceWords) return Text;
|
||||
if (_MyItemInfo.MyContent.Type < 20000) return Text; // for now only replace in steps.
|
||||
FoundMatches myMatches = new FoundMatches(Text,_MyItemInfo.FormatStepData.Font,_MyItemInfo);
|
||||
FoundMatches myMatches = new FoundMatches(Text, _MyItemInfo.FormatStepData.Font, _MyItemInfo);
|
||||
// Exclude Link Text from Replace Word process
|
||||
myMatches.AddLink(regFindLink, _MyFormat.PlantFormat.FormatData.SectData.ReplaceWordsInROs, _MyItemInfo.MyProcedure.MyDocVersion);
|
||||
ReplaceStrList rsl = _MyFormat.PlantFormat.FormatData.SectData.ReplaceStrList;
|
||||
|
||||
// The only way to get an 'empty' list is to have one 'dummy' replacestr, i.e. that has ReplaceWord as an empty string. If the
|
||||
// ReplaceStrData xml node is empty, it does the inheritance and gets the 'base' format's list.
|
||||
if (rsl.Count==1 && (rsl[0].ReplaceWord == null || rsl[0].ReplaceWord == "")) return Text;
|
||||
// Loop through text looking for words to be replaced
|
||||
@@ -1845,6 +1843,7 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
//ProfileTimer.Pop(profileDepth);
|
||||
//int profileDepth5 = ProfileTimer.Push(">>>> DoReplaceWords2.ReplaceMatches");
|
||||
|
||||
Text = myMatches.ReplaceMatches();
|
||||
//ProfileTimer.Pop(profileDepth5);
|
||||
Text = Text.Replace(@"\xA0", @"\u160?"); //replace hard space
|
||||
@@ -2150,10 +2149,11 @@ namespace Volian.Controls.Library
|
||||
if (text.StartsWith(@"{\rtf"))
|
||||
{
|
||||
// make sure that it is not preceded by \u160? \'a0 or \~
|
||||
if(Regex.IsMatch(begin,@"(\\(u160\?|'a0|~)(\\f[0-9]* ?)*(\\fs[0-9]* ?)*)$"))
|
||||
// bug fix B2015-197 - need to consider underline and bold commands between a hard space and a word
|
||||
if (Regex.IsMatch(begin, @"(\\(u160\?|'a0|~)(\\ulnone ?|\\b0 ?|\\ul ?|\\b ?)*(\\f[0-9]* ?)*(\\fs[0-9]* ?)*)$"))
|
||||
return false;
|
||||
// make sure that it is not followed by \u160? \'a0 or \~
|
||||
if (Regex.IsMatch(end, @"^((\\f[0-9]* ?)*(\\fs[0-9]* ?)*\\(u160\?|'a0|~))"))
|
||||
if (Regex.IsMatch(end, @"^((\\f[0-9]* ?)*(\\fs[0-9]* ?)*(\\ulnone ?|\\b0 ?|\\ul ?|\\b ?)*\\(u160\?|'a0|~))"))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user