Adding a more realistic key down/up event with null key.

This commit is contained in:
BDisp
2022-09-28 10:35:10 +01:00
parent 702ef46727
commit eaaa636497
2 changed files with 87 additions and 21 deletions

View File

@@ -388,19 +388,23 @@ namespace Terminal.Gui {
void ProcessInput (ConsoleKeyInfo consoleKey)
{
keyModifiers = new KeyModifiers ();
var map = MapKey (consoleKey);
if (map == (Key)0xffffffff)
return;
if (consoleKey.Modifiers.HasFlag (ConsoleModifiers.Alt)) {
keyModifiers.Alt = true;
}
if (consoleKey.Modifiers.HasFlag (ConsoleModifiers.Shift)) {
keyModifiers.Shift = true;
}
if (consoleKey.Modifiers.HasFlag (ConsoleModifiers.Alt)) {
keyModifiers.Alt = true;
}
if (consoleKey.Modifiers.HasFlag (ConsoleModifiers.Control)) {
keyModifiers.Ctrl = true;
}
var map = MapKey (consoleKey);
if (map == (Key)0xffffffff) {
if ((consoleKey.Modifiers & (ConsoleModifiers.Shift | ConsoleModifiers.Alt | ConsoleModifiers.Control)) != 0) {
keyDownHandler (new KeyEvent (map, keyModifiers));
keyUpHandler (new KeyEvent (map, keyModifiers));
}
return;
}
keyDownHandler (new KeyEvent (map, keyModifiers));
keyHandler (new KeyEvent (map, keyModifiers));