diff --git a/PROMS/Volian.Controls.Library/StepRTB.cs b/PROMS/Volian.Controls.Library/StepRTB.cs index 57a9acdd..0a727981 100644 --- a/PROMS/Volian.Controls.Library/StepRTB.cs +++ b/PROMS/Volian.Controls.Library/StepRTB.cs @@ -443,26 +443,22 @@ namespace Volian.Controls.Library int indchar = 0; string indentToken = MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IndentToken; if (indentToken == null || indentToken=="0") indentToken = "\x5"; + + // 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. + AddEventHandlers(); + while ((indchar = Find(indentToken, indchar, RichTextBoxFinds.None)) >= 0) { Point indent = GetPositionFromCharIndex(indchar); SelectionHangingIndent = indent.X; - indchar++; + SelectedRtf = SelectedRtf.Replace(@"\'05",""); } - AddEventHandlers(); } - //else - //{ - // if (MyRTBItem != null && (_MyItemInfo.IsTable || _MyItemInfo.IsFigure)) - // { - // //MyRTBItem.ItemWidth = (int)MyRTBItem.TableWidth(Font, Text,false); - // MyRTBItem.ItemWidth = MyRTBItem.MyStepPanel.ToDisplay(MyRTBItem.MyStepSectionLayoutData.WidT); - // } - //} OrigRTF = Rtf; _InitializingRTB = false; - AdjustSizeForContents(!ActiveMode); // TODO: this is not quite right yet. + AdjustSizeForContents(!ActiveMode); } private bool _ProcessKeystrokes = true; public bool ProcessKeystrokes @@ -470,25 +466,6 @@ namespace Volian.Controls.Library get { return _ProcessKeystrokes; } set { _ProcessKeystrokes = value; } } - - //public EnterKeyHandler EnterKeyPressed; - //protected override bool ProcessCmdKey(ref Message msg, Keys keyData) - //{ - // const int WM_KEYDOWN = 0x100; - // const int WM_SYSKEYDOWN = 0x104; - // if ((msg.Msg == WM_KEYDOWN) || (msg.Msg == WM_SYSKEYDOWN)) - // { - // switch (keyData) - // { - // case Keys.Control | Keys.V: - // // check for valid data to be inserted: - // return base.ProcessCmdKey(ref msg, keyData); - // default: - // return base.ProcessCmdKey(ref msg, keyData); - // } - // } - // return base.ProcessCmdKey(ref msg, keyData); - //} private Point ScrollPos { get { return RTBAPI.GetScrollLocation(this); } @@ -738,7 +715,7 @@ namespace Volian.Controls.Library } public void InsertIndent(string indentToken) { - if (indentToken == null) indentToken = "\x5"; + if (indentToken == null || indentToken == "0") indentToken = "\x5"; AddText(indentToken); } public void InsertText(string txt)