mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
This commit is contained in:
@@ -1677,6 +1677,11 @@ namespace Terminal.Gui {
|
||||
var c = ((uint)kb.Key & (uint)Key.CharMask);
|
||||
for (int i = 0; i < children.Length; i++) {
|
||||
var mi = children [i];
|
||||
|
||||
if (mi == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int p = mi.Title.IndexOf (MenuBar.HotKeySpecifier);
|
||||
if (p != -1 && p + 1 < mi.Title.RuneCount) {
|
||||
if (Char.ToUpperInvariant ((char)mi.Title [p + 1]) == c) {
|
||||
|
||||
@@ -1809,5 +1809,20 @@ Edit
|
||||
Assert.True (menu.ProcessHotKey (new KeyEvent (menu.Key, new KeyModifiers ())));
|
||||
Assert.False (menu.IsMenuOpen);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Separators_Does_Not_Throws_Pressing_Menu_Shortcut ()
|
||||
{
|
||||
var menu = new MenuBar (new MenuBarItem [] {
|
||||
new MenuBarItem ("File", new MenuItem [] {
|
||||
new MenuItem ("_New", "", null),
|
||||
null,
|
||||
new MenuItem ("_Quit", "", null)
|
||||
})
|
||||
});
|
||||
|
||||
var exception = Record.Exception (() => Assert.True (menu.ProcessHotKey (new KeyEvent (Key.AltMask | Key.Q, new KeyModifiers () { Alt = true }))));
|
||||
Assert.Null (exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user