public void RegisterKeyPress(ConsoleKeyInfo key)
{
Context.Reset();
Context.KeyPressed = key;
Context.CharacterToWrite = new ConsoleCharacter(Context.KeyPressed.KeyChar);
IKeyHandler handler = null;
if (KeyHandlers.TryGetValue(Context.KeyPressed.Key, out handler) == false && RichTextCommandLineReader.IsWriteable(Context.KeyPressed))
{
WriteCharacterForPressedKey(Context.KeyPressed);
DoSyntaxHighlighting(Context);
}
else if (handler != null)
{
handler.Handle(Context);
if (Context.Intercept == false && RichTextCommandLineReader.IsWriteable(Context.KeyPressed))
{
WriteCharacterForPressedKey(Context.KeyPressed);
}
DoSyntaxHighlighting(Context);
}
FireValueChanged();
}