Tig пре 7 месеци
родитељ
комит
0586c303a7

+ 1 - 1
Terminal.Gui/View/View.Keyboard.cs

@@ -591,7 +591,7 @@ public partial class View // Keyboard APIs
         return false;
         return false;
     }
     }
 
 
-    private bool InvokeCommandsBoundToHotKeyOnSubviews (Key key, ref bool? handled, bool invoke = true)
+    internal bool InvokeCommandsBoundToHotKeyOnSubviews (Key key, ref bool? handled, bool invoke = true)
     {
     {
         bool? weHandled = InvokeCommandsBoundToKey (key, KeyBindingScope.HotKey);
         bool? weHandled = InvokeCommandsBoundToKey (key, KeyBindingScope.HotKey);
         if (weHandled is true)
         if (weHandled is true)

+ 1 - 5
Terminal.Gui/Views/Menu/ContextMenu.cs

@@ -109,9 +109,7 @@ public sealed class ContextMenu : IDisposable
         _menuBar?.Dispose ();
         _menuBar?.Dispose ();
         _menuBar = null;
         _menuBar = null;
         IsShow = false;
         IsShow = false;
-
-        Application.KeyBindings.Remove (Key);
-
+        `
         if (_container is { })
         if (_container is { })
         {
         {
             _container.Closing -= Container_Closing;
             _container.Closing -= Container_Closing;
@@ -253,8 +251,6 @@ public sealed class ContextMenu : IDisposable
         _menuBar._isContextMenuLoading = true;
         _menuBar._isContextMenuLoading = true;
         _menuBar.MenuAllClosed += MenuBar_MenuAllClosed;
         _menuBar.MenuAllClosed += MenuBar_MenuAllClosed;
 
 
-        Application.KeyBindings.Add (Key, _menuBar, Command.Cancel);
-
         _menuBar.BeginInit ();
         _menuBar.BeginInit ();
         _menuBar.EndInit ();
         _menuBar.EndInit ();
         IsShow = true;
         IsShow = true;

+ 2 - 1
Terminal.Gui/Views/Menu/Menu.cs

@@ -250,7 +250,8 @@ internal sealed class Menu : View
     protected override bool OnKeyDownNotHandled (Key keyEvent)
     protected override bool OnKeyDownNotHandled (Key keyEvent)
     {
     {
         // We didn't handle the key, pass it on to host
         // We didn't handle the key, pass it on to host
-        return _host.InvokeCommandsBoundToKey (keyEvent) == true;
+        bool? handled = null;
+        return _host.InvokeCommandsBoundToHotKeyOnSubviews (keyEvent, ref handled, true ) == true;
     }
     }
 
 
     protected override bool OnMouseEvent (MouseEventArgs me)
     protected override bool OnMouseEvent (MouseEventArgs me)