public virtual bool KeyPress(KeyDescriptor descriptor)
{
// build repeat buffer
if (_command == null && (_count > 0 || descriptor.KeyChar > '0') && descriptor.KeyChar >= '0' && descriptor.KeyChar <= '9')
{
_count = (_count * 10) + (descriptor.KeyChar - 48);
return false;
}
_buf += Char.ToString(descriptor.KeyChar);
if (_command == null)
{
if (descriptor.ModifierKeys == ModifierKeys.Control)
_buf = "^" + _buf;
if (!SpecialKeyCommandMap.TryGetValue(descriptor.SpecialKey, out _command))
{
if (!CommandMap.ContainsKey(_buf))
{
foreach (var k in CommandMap.Keys)
{
if (k.StartsWith(_buf, StringComparison.Ordinal))
return false;
}
Reset();
return false;
}
_command = CommandMap[_buf];
}
_buf = "";
if (_command.TakeArgument)
return false;
}
CaretOffEol();
RequestedMode = _command.RunCommand(_count, (char)(_buf.Length > 0 ? _buf[0] : 0));
_command = null;
Reset();
CaretOffEol();
return false;
}