Added wide improvements on keys managements.

This commit is contained in:
BDisp
2020-10-26 00:46:51 +00:00
parent 4729f46726
commit 01d4b4f55f
30 changed files with 783 additions and 579 deletions

View File

@@ -168,7 +168,7 @@ namespace Terminal.Gui {
Console.MockKeyPresses.Push (new ConsoleKeyInfo ('q', ConsoleKey.Q, shift: false, alt: false, control: true));
foreach (var c in input.Reverse ()) {
if (char.IsLetter (c)) {
Console.MockKeyPresses.Push (new ConsoleKeyInfo (char.ToLower (c), (ConsoleKey)char.ToUpper (c), shift: char.IsUpper (c), alt: false, control: false));
Console.MockKeyPresses.Push (new ConsoleKeyInfo (c, (ConsoleKey)char.ToUpper (c), shift: char.IsUpper (c), alt: false, control: false));
} else {
Console.MockKeyPresses.Push (new ConsoleKeyInfo (c, (ConsoleKey)c, shift: false, alt: false, control: false));
}
@@ -188,7 +188,7 @@ namespace Terminal.Gui {
int keyUps = 0;
var output = string.Empty;
Application.Top.KeyUp += (View.KeyEventEventArgs args) => {
if (args.KeyEvent.Key != Key.ControlQ) {
if (args.KeyEvent.Key != (Key.CtrlMask | Key.Q)) {
output += (char)args.KeyEvent.KeyValue;
}
keyUps++;

View File

@@ -119,7 +119,7 @@ namespace Terminal.Gui {
var token = Application.MainLoop.AddTimeout (TimeSpan.FromMilliseconds (ms), abortCallback);
Application.Top.KeyPress += (View.KeyEventEventArgs args) => {
Assert.Equal (Key.ControlQ, args.KeyEvent.Key);
Assert.Equal (Key.CtrlMask | Key.Q, args.KeyEvent.Key);
};
var scenario = (Scenario)Activator.CreateInstance (scenarioClass);