Przeglądaj źródła

make keybindings share base

tznind 7 miesięcy temu
rodzic
commit
c18cff280e

+ 2 - 2
Terminal.Gui/Input/Keyboard/KeyBindings.cs

@@ -7,10 +7,10 @@ namespace Terminal.Gui;
 /// <seealso cref="Application.KeyBindings"/>
 /// <seealso cref="View.KeyBindings"/>
 /// <seealso cref="Command"/>
-public class KeyBindings
+public class KeyBindings : Bindings<Key,KeyBinding>
 {
     /// <summary>Initializes a new instance bound to <paramref name="target"/>.</summary>
-    public KeyBindings (View? target) { Target = target; }
+    public KeyBindings (View? target) :base((commands,key)=> new KeyBinding (commands)) { Target = target; }
 
     /// <summary>Adds a <see cref="KeyBinding"/> to the collection.</summary>
     /// <param name="key"></param>

+ 1 - 1
Terminal.Gui/Input/Mouse/MouseBindings.cs

@@ -3,7 +3,7 @@ using System.Collections.Generic;
 
 namespace Terminal.Gui;
 
-public abstract class Bindings<TKey, TBind> where TKey: Enum where TBind : IInputBinding, new()
+public abstract class Bindings<TKey, TBind>  where TBind : IInputBinding, new()
 {
     protected readonly Dictionary<TKey, TBind> _bindings = new ();
     private readonly Func<Command [], TKey, TBind> _constructBinding;