Fix B2016-093: Sometimes windows are left blue after adding RO

This commit is contained in:
Kathy Ruffing 2016-04-05 15:26:58 +00:00
parent fcd21ac6d1
commit 8c8aad861b

View File

@ -541,7 +541,7 @@ namespace Volian.Controls.Library
//if (SelectionHangingIndent !=0) SelectionHangingIndent = 0; //if (SelectionHangingIndent !=0) SelectionHangingIndent = 0;
int indchar = 0; int indchar = 0;
string indentToken = MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IndentToken; string indentToken = MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IndentToken;
if (indentToken == null || indentToken=="0") indentToken = "\x5"; if (indentToken == null || indentToken == "0") indentToken = "\x5";
// this line of code was moved before the find for the indent so that // this line of code was moved before the find for the indent so that
// the window gets resized if the indent changes the height, i.e. more line(s) in window. // the window gets resized if the indent changes the height, i.e. more line(s) in window.
@ -550,20 +550,20 @@ namespace Volian.Controls.Library
if ((indchar = Find(indentToken, indchar, RichTextBoxFinds.None)) >= 0) if ((indchar = Find(indentToken, indchar, RichTextBoxFinds.None)) >= 0)
{ {
int nindents = 0; int nindents = 0;
while ((indchar = Find(indentToken, indchar, RichTextBoxFinds.None)) >= 0) while ((indchar = Find(indentToken, indchar, RichTextBoxFinds.None)) >= 0)
{ {
nindents++; nindents++;
Point indent = GetPositionFromCharIndex(indchar); Point indent = GetPositionFromCharIndex(indchar);
SelectionHangingIndent = indent.X; SelectionHangingIndent = indent.X;
// RHM 02/20/2013 // RHM 02/20/2013
// The following line attempts to remove the indent character for display purposes. // The following line attempts to remove the indent character for display purposes.
// However, if the indent is followed immediately by an RO or Transition the // However, if the indent is followed immediately by an RO or Transition the
// RichTextBox will not allow the character to be removed this way and the RichTextBox // RichTextBox will not allow the character to be removed this way and the RichTextBox
// will beep. So, to keep from going in an infintie loop, the value of indchar is incremented. // will beep. So, to keep from going in an infintie loop, the value of indchar is incremented.
SelectedRtf = SelectedRtf.Replace(@"\'05",""); SelectedRtf = SelectedRtf.Replace(@"\'05", "");
indchar ++;// Don't so the same one twice. indchar++;// Don't so the same one twice.
} }
if (MyItemInfo != null && MyItemInfo.ActiveFormat != null if (MyItemInfo != null && MyItemInfo.ActiveFormat != null
&& MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.DontResetIndentOnNewline) && MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.DontResetIndentOnNewline)
{ {
@ -571,6 +571,7 @@ namespace Volian.Controls.Library
Rtf = Rtf.Replace(@"\line\pard", @"\line"); Rtf = Rtf.Replace(@"\line\pard", @"\line");
} }
} }
HideSelection = true; // fix for B2016-093: this is needed so an rtb that is not focused is not highlighted.
} }
// This is to fix an issue with Hard Spaces. To Summarize: // This is to fix an issue with Hard Spaces. To Summarize:
// The Microsoft RichTextBox has a problem with hardspaces, that they don't work between numbers and lettters // The Microsoft RichTextBox has a problem with hardspaces, that they don't work between numbers and lettters