public void SimulateKeyPress(char ch)
{
if (Document.ReadOnly)
{
return;
}
if (TextEditorProperties.UseCustomLine == true)
{
if (SelectionManager.HasSomethingSelected)
{
if (Document.CustomLineManager.IsReadOnly(SelectionManager.SelectionCollection[0], false))
{
return;
}
}
else if (Document.CustomLineManager.IsReadOnly(Caret.Line, false) == true)
{
return;
}
}
if (ch < ' ')
{
return;
}
if (!HiddenMouseCursor && TextEditorProperties.HideMouseCursor)
{
HiddenMouseCursor = true;
Cursor.Hide();
}
if (!HandleKeyPress(ch))
{
motherTextEditorControl.BeginUpdate();
switch (Caret.CaretMode)
{
case CaretMode.InsertMode:
InsertChar(ch);
break;
case CaretMode.OverwriteMode:
ReplaceChar(ch);
break;
default:
Debug.Assert(false, "Unknown caret mode " + Caret.CaretMode);
break;
}
int currentLineNr = Caret.Line;
int delta = Document.FormattingStrategy.FormatLine(this, currentLineNr, Document.PositionToOffset(Caret.Position), ch);
motherTextEditorControl.EndUpdate();
}
}