Browse Source

Fixed dumb enum cast in KeyBinding code

Tig 1 year ago
parent
commit
d813b1f137

+ 2 - 1
Terminal.Gui/Application/Application.Keyboard.cs

@@ -144,7 +144,8 @@ public static partial class Application // Keyboard handling
         {
             foreach (View view in binding.Value)
             {
-                if (view is {} && view.KeyBindings.TryGet (binding.Key, (KeyBindingScope)0xFFFF, out KeyBinding kb))
+                if (view is { }
+                    && view.KeyBindings.TryGet (binding.Key, KeyBindingScope.Focused | KeyBindingScope.HotKey | KeyBindingScope.Application, out KeyBinding kb))
                 {
                     //bool? handled = view.InvokeCommands (kb.Commands, binding.Key, kb);
                     bool? handled = view?.OnInvokingKeyBindings (keyEvent, kb.Scope);

+ 3 - 1
Terminal.Gui/Input/Command.cs

@@ -221,10 +221,12 @@ public enum Command
     /// <summary>Pastes the current selection.</summary>
     Paste,
 
-    // TODO: IRunnable - Should be renamed QuitRunnable
+    /// TODO: IRunnable: Rename to Command.Quit to make more generic.
     /// <summary>Quit a <see cref="Toplevel"/>.</summary>
     QuitToplevel,
 
+    /// TODO: Overlapped: Add Command.ShowHide
+
     /// <summary>Suspend an application (Only implemented in <see cref="CursesDriver"/>).</summary>
     Suspend,
 

+ 1 - 1
Terminal.Gui/Input/KeyBindingScope.cs

@@ -45,5 +45,5 @@ public enum KeyBindingScope
     ///         any of its subviews, and if the key was not bound to a <see cref="View.HotKey"/>.
     ///     </para>
     /// </remarks>
-    Application = 4
+    Application = 4,
 }