From d7407d60fa1fa5343a85c43c81a0a8512a519166 Mon Sep 17 00:00:00 2001 From: John Date: Thu, 17 Apr 2014 16:25:41 +0000 Subject: [PATCH] Fixed Replace words logic to handle underline better. --- PROMS/Volian.Controls.Library/DisplayText.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/PROMS/Volian.Controls.Library/DisplayText.cs b/PROMS/Volian.Controls.Library/DisplayText.cs index 5db7e1e2..4911211a 100644 --- a/PROMS/Volian.Controls.Library/DisplayText.cs +++ b/PROMS/Volian.Controls.Library/DisplayText.cs @@ -1833,9 +1833,15 @@ namespace Volian.Controls.Library // had replaced OR's turning underline off in the middle of a transition, "EOP-0 UNIT 1, RACTORE TRIP OR SAFETY INJECTION". if (!IsUnderline) { - int repidxst = text.LastIndexOf(@"\ul ", foundMatch.MyMatch.Index); - int repidxend = text.IndexOf(@"\ulnone", foundMatch.MyMatch.Index + foundMatch.MyMatch.Length); - if (repidxst > -1 && repidxend > -1 && repidxst < foundMatch.MyMatch.Index && repidxend > (foundMatch.MyMatch.Index + foundMatch.MyMatch.Length)) IsUnderline = true; + int repidxulnone = text.LastIndexOf(@"\ulnone", foundMatch.MyMatch.Index + offset); + int repidxst = text.LastIndexOf(@"\ul", foundMatch.MyMatch.Index + offset); + if (repidxulnone > 0) + { + repidxst = text.Substring(repidxulnone + 7, foundMatch.MyMatch.Index + offset - (repidxulnone + 7)).LastIndexOf(@"\ul"); + if (repidxst >= 0) + repidxst += (repidxulnone + 7); + } + if (repidxst >= 0) IsUnderline = true; } if (IsUnderline) {