public AddCharToCurrentLine ( char c ) : void | ||
c | char | |
return | void |
public void AddCharToCurrentLine(char c)
{
updateJustCurrentLine = true;
bool passRemoveSelectedText = false;
#if DEBUG
if (dbugEnableTextManRecorder)
{
dbugTextManRecorder.WriteInfo("TxLMan::AddCharToCurrentLine " + c);
dbugTextManRecorder.BeginContext();
}
#endif
if (SelectionRange != null)
{
#if DEBUG
if (dbugEnableTextManRecorder)
{
dbugTextManRecorder.WriteInfo(SelectionRange);
}
#endif
RemoveSelectedText();
passRemoveSelectedText = true;
}
if (passRemoveSelectedText && c == ' ')
{
}
else
{
commandHistory.AddDocAction(
new DocActionCharTyping(c, textLineWriter.LineNumber, textLineWriter.CharIndex));
}
textLineWriter.AddCharacter(c);
#if DEBUG
if (dbugEnableTextManRecorder)
{
dbugTextManRecorder.EndContext();
}
#endif
}
public EditableRun CurrentTextRun
public void OnKeyPress(UIKeyEventArgs e) { this.SetCaretState(true); //------------------------ if (e.IsControlCharacter) { OnKeyDown(e); return; } char c = e.KeyChar; e.CancelBubbling = true; if (internalTextLayerController.SelectionRange != null && internalTextLayerController.SelectionRange.IsValid) { InvalidateGraphicLocalArea(this, GetSelectionUpdateArea()); } bool preventDefault = false; if (textSurfaceEventListener != null && !(preventDefault = TextSurfaceEventListener.NotifyPreviewKeydown(textSurfaceEventListener, c))) { internalTextLayerController.UpdateSelectionRange(); } if (preventDefault) { return; } if (internalTextLayerController.SelectionRange != null) { internalTextLayerController.AddCharToCurrentLine(c); if (textSurfaceEventListener != null) { TextSurfaceEventListener.NotifyCharactersReplaced(textSurfaceEventListener, e.KeyChar); } } else { internalTextLayerController.AddCharToCurrentLine(c); if (textSurfaceEventListener != null) { TextSurfaceEventListener.NotifyCharacterAdded(textSurfaceEventListener, e.KeyChar); } } EnsureCaretVisible(); if (textSurfaceEventListener != null) { TextSurfaceEventListener.NotifyKeyDown(textSurfaceEventListener, e.KeyCode); } }