From f96212221da6fb0e585090cc00dee6b0e67d047f Mon Sep 17 00:00:00 2001 From: John Date: Fri, 8 Jul 2016 13:53:06 +0000 Subject: [PATCH] Logic to find when words are bolded or underlined also fixed logic in looking at the next item --- PROMS/Volian.Controls.Library/FindReplace.cs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/PROMS/Volian.Controls.Library/FindReplace.cs b/PROMS/Volian.Controls.Library/FindReplace.cs index fdcb2e8e..89eb46a8 100644 --- a/PROMS/Volian.Controls.Library/FindReplace.cs +++ b/PROMS/Volian.Controls.Library/FindReplace.cs @@ -175,6 +175,7 @@ namespace Volian.Controls.Library doingfind = false; this.Visible = false; } + private string FixSymbol(string str) { StringBuilder sb = new StringBuilder(); @@ -187,6 +188,22 @@ namespace Volian.Controls.Library } return sb.ToString(); } + // B2015-131 Break up the find string on the spaces + // look for each word in the text string + // this is used only to see if the next item should be looked at, the real Find function (i.e MyEditItem.FindText()) + // will do the actual evaluation + private bool ContainsFndStr(string text, string fndStr) + { + char [] sep ={' '}; // break string up on spaces + string [] fndStrAry = fndStr.Split(sep, StringSplitOptions.None); + int pos = 0; + foreach (string fStr in fndStrAry) + { + pos = text.IndexOf(fStr, pos); + if (pos == -1) break; + } + return pos != -1; + } private void btnFindNext_Click(object sender, EventArgs e) { AddToComboLists(); @@ -196,7 +213,8 @@ namespace Volian.Controls.Library { ItemInfo next = (cbxReverse.Checked) ? MyEditItem.MyItemInfo.SearchPrev : MyEditItem.MyItemInfo.SearchNext; - while ((next != null) && !next.IsSection && !RtfTools.RTFConvertedSymbolsToUnicode(next.MyContent.Text).Contains(fndStr)) + // B2015-131 Find was not finding series of words when one or more of the words were bolded or underlined (ex finding "Any SG" where Any was bolded) + while ((next != null) && !next.IsSection && !ContainsFndStr(RtfTools.RTFConvertedSymbolsToUnicode(next.MyContent.Text).ToUpper(), fndStr.ToUpper())) { next = (cbxReverse.Checked) ? next.SearchPrev : next.SearchNext; }