瀏覽代碼

Key API simplification

Tig 9 月之前
父節點
當前提交
89d8b74c3d

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

@@ -73,7 +73,7 @@ public partial class View // Keyboard APIs
     ///     <para>If the hot key is changed, the <see cref="HotKeyChanged"/> event is fired.</para>
     ///     <para>Set to <see cref="Key.Empty"/> to disable the hot key.</para>
     /// </remarks>
-    public virtual Key HotKey
+    public Key HotKey
     {
         get => _hotKey;
         set
@@ -684,8 +684,6 @@ public partial class View // Keyboard APIs
     /// </returns>
     protected bool? InvokeCommands (Key key, KeyBindingScope scope)
     {
-        bool? toReturn = null;
-
         if (!KeyBindings.TryGet (key, scope, out KeyBinding binding))
         {
             return null;

+ 0 - 1
Terminal.Gui/View/View.Layout.cs

@@ -28,7 +28,6 @@ public partial class View // Layout APIs
     /// <param name="targetY">The target y location.</param>
     /// <param name="nx">The new x location that will ensure <paramref name="viewToMove"/> will be fully visible.</param>
     /// <param name="ny">The new y location that will ensure <paramref name="viewToMove"/> will be fully visible.</param>
-    /// <param name="statusBar">The new top most statusBar</param>
     /// <returns>
     ///     Either <see cref="Application.Top"/> (if <paramref name="viewToMove"/> does not have a Super View) or
     ///     <paramref name="viewToMove"/>'s SuperView. This can be used to ensure LayoutSubviews is called on the correct View.

+ 1 - 1
Terminal.Gui/Views/ListView.cs

@@ -806,7 +806,7 @@ public class ListView : View, IDesignable
     protected override bool OnKeyDown (Key a)
     {
         // Enable user to find & select an item by typing text
-        if (CollectionNavigatorBase.IsCompatibleKey (a) && (!AllowsMarking && a == Key.Space))
+        if (CollectionNavigatorBase.IsCompatibleKey (a) || (!AllowsMarking && a == Key.Space))
         {
             int? newItem = KeystrokeNavigator?.GetNextMatchingItem (SelectedItem, (char)a);
 

+ 1 - 4
UICatalog/Scenarios/Keys.cs

@@ -94,10 +94,7 @@ public class Keys : Scenario
 
         edit.KeyDownNotHandled += (s, a) =>
                                   {
-                                      if (edit.KeyBindings.TryGet (a, out KeyBinding binding))
-                                      {
-                                          keyDownNotHandledList.Add ($"{a}: {string.Join (",", binding.Commands)}");
-                                      }
+                                      keyDownNotHandledList.Add ($"{a}");
                                   };
 
         // KeyDown