The KeyPress event must only be used by the most focused view in the ProcessHotKey event. (#1614)

This commit is contained in:
BDisp
2022-02-27 07:59:50 +00:00
committed by GitHub
parent 56c28f6d37
commit a9a0d176c1
3 changed files with 110 additions and 14 deletions

View File

@@ -430,7 +430,7 @@ namespace Terminal.Gui.ConsoleDrivers {
var okClicked = false;
var closing = false;
var cursorRight = false;
var cancelHasFocus = false;
var endingKeyPress = false;
var closed = false;
var top = Application.Top;
@@ -464,9 +464,7 @@ namespace Terminal.Gui.ConsoleDrivers {
if (!cursorRight) {
cursorRight = true;
} else if (ok.HasFocus) {
e.Handled = true;
} else {
cancelHasFocus = true;
e.Handled = endingKeyPress = true;
}
}
};
@@ -497,7 +495,7 @@ namespace Terminal.Gui.ConsoleDrivers {
Assert.True (okClicked);
Assert.True (closing);
Assert.True (cursorRight);
Assert.True (cancelHasFocus);
Assert.True (endingKeyPress);
Assert.True (closed);
Assert.Empty (FakeConsole.MockKeyPresses);
}