Skip to content

Commit 2b8884a

Browse files
committed
Finished integrated tznind's work.
1 parent 23344ba commit 2b8884a

File tree

22 files changed

+334
-525
lines changed

22 files changed

+334
-525
lines changed

Terminal.Gui/Application/Application.Keyboard.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,17 @@ public static bool RaiseKeyDownEvent (Key key)
6464
}
6565
else
6666
{
67-
if (!KeyBindings.TryGet (key, out KeyBinding appBinding))
67+
// BUGBUG: this seems unneeded.
68+
if (!KeyBindings.TryGet (key, out KeyBinding keybinding))
6869
{
6970
return false;
7071
}
7172

7273
bool? toReturn = null;
7374

74-
foreach (Command command in appBinding.Commands)
75+
foreach (Command command in keybinding.Commands)
7576
{
76-
toReturn = InvokeCommand (command, key, appBinding);
77+
toReturn = InvokeCommand (command, key, keybinding);
7778
}
7879

7980
return toReturn ?? true;
@@ -82,7 +83,7 @@ public static bool RaiseKeyDownEvent (Key key)
8283

8384
return false;
8485

85-
static bool? InvokeCommand (Command command, Key key, KeyBinding appBinding)
86+
static bool? InvokeCommand (Command command, Key key, KeyBinding binding)
8687
{
8788
if (!_commandImplementations!.ContainsKey (command))
8889
{
@@ -93,7 +94,7 @@ public static bool RaiseKeyDownEvent (Key key)
9394

9495
if (_commandImplementations.TryGetValue (command, out View.CommandImplementation? implementation))
9596
{
96-
CommandContext<KeyBinding> context = new (command, appBinding); // Create the context here
97+
CommandContext<KeyBinding> context = new (command, binding); // Create the context here
9798

9899
return implementation (context);
99100
}

Terminal.Gui/Application/Application.Navigation.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public static Key NextTabGroupKey
2222
{
2323
if (_nextTabGroupKey != value)
2424
{
25-
KeyBindings.ReplaceKey (_nextTabGroupKey, value);
25+
KeyBindings.Replace (_nextTabGroupKey, value);
2626
_nextTabGroupKey = value;
2727
}
2828
}
@@ -37,7 +37,7 @@ public static Key NextTabKey
3737
{
3838
if (_nextTabKey != value)
3939
{
40-
KeyBindings.ReplaceKey (_nextTabKey, value);
40+
KeyBindings.Replace (_nextTabKey, value);
4141
_nextTabKey = value;
4242
}
4343
}
@@ -66,7 +66,7 @@ public static Key PrevTabGroupKey
6666
{
6767
if (_prevTabGroupKey != value)
6868
{
69-
KeyBindings.ReplaceKey (_prevTabGroupKey, value);
69+
KeyBindings.Replace (_prevTabGroupKey, value);
7070
_prevTabGroupKey = value;
7171
}
7272
}
@@ -81,7 +81,7 @@ public static Key PrevTabKey
8181
{
8282
if (_prevTabKey != value)
8383
{
84-
KeyBindings.ReplaceKey (_prevTabKey, value);
84+
KeyBindings.Replace (_prevTabKey, value);
8585
_prevTabKey = value;
8686
}
8787
}

Terminal.Gui/Application/Application.Run.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public static Key QuitKey
1919
{
2020
if (_quitKey != value)
2121
{
22-
KeyBindings.ReplaceKey (_quitKey, value);
22+
KeyBindings.Replace (_quitKey, value);
2323
_quitKey = value;
2424
}
2525
}
@@ -37,7 +37,7 @@ public static Key ArrangeKey
3737
{
3838
if (_arrangeKey != value)
3939
{
40-
KeyBindings.ReplaceKey (_arrangeKey, value);
40+
KeyBindings.Replace (_arrangeKey, value);
4141
_arrangeKey = value;
4242
}
4343
}

Terminal.Gui/Input/Bindings.cs

Lines changed: 0 additions & 150 deletions
This file was deleted.

Terminal.Gui/Input/IInputBinding.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
#nullable enable
22
namespace Terminal.Gui;
33

4+
/// <summary>
5+
/// Describes an input binding. Used to bind a set of <see cref="Command"/> objects to a specific input event.
6+
/// </summary>
47
public interface IInputBinding
58
{
9+
/// <summary>
10+
/// Gets or sets the commands this input binding will invoke.
11+
/// </summary>
612
Command [] Commands { get; set; }
713
}

0 commit comments

Comments
 (0)