make keybindings share base

This commit is contained in:
tznind
2024-12-09 20:43:32 +00:00
parent 9002acf942
commit c18cff280e
2 changed files with 3 additions and 3 deletions

View File

@@ -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>

View File

@@ -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;