From 65cf641685ed92736384043751014d24ef1fe70b Mon Sep 17 00:00:00 2001 From: Tig Date: Thu, 5 Dec 2024 15:04:23 -0700 Subject: [PATCH] Fixed CheckBox issue --- Terminal.Gui/Input/Mouse/MouseBinding.cs | 9 +- Terminal.Gui/Input/Mouse/MouseBindings.cs | 132 ++++++++++++---------- Terminal.Gui/View/View.Mouse.cs | 8 +- Terminal.Gui/Views/Button.cs | 12 +- Terminal.Gui/Views/CheckBox.cs | 20 ++-- Terminal.Gui/Views/ColorPicker.16.cs | 28 +---- Terminal.Gui/Views/ComboBox.cs | 6 +- Terminal.Gui/Views/Label.cs | 7 +- Terminal.Gui/Views/Shortcut.cs | 22 ++-- Terminal.Gui/Views/Slider.cs | 8 +- Terminal.Gui/Views/TextView.cs | 10 +- Terminal.Gui/Views/TreeView/TreeView.cs | 6 +- UnitTests/Views/AllViewsTests.cs | 10 +- 13 files changed, 127 insertions(+), 151 deletions(-) diff --git a/Terminal.Gui/Input/Mouse/MouseBinding.cs b/Terminal.Gui/Input/Mouse/MouseBinding.cs index 01ceb09e1..f9f7911c1 100644 --- a/Terminal.Gui/Input/Mouse/MouseBinding.cs +++ b/Terminal.Gui/Input/Mouse/MouseBinding.cs @@ -10,11 +10,18 @@ public record struct MouseBinding { /// Initializes a new instance. /// The commands this mouse binding will invoke. - public MouseBinding (Command [] commands) + /// The mouse event arguments, to be passed as context. + public MouseBinding (Command [] commands, MouseEventArgs? mouseEventArgs) { Commands = commands; + MouseEventArgs = mouseEventArgs; } /// The commands this key binding will invoke. public Command [] Commands { get; set; } + + /// + /// The mouse event arguments. + /// + public MouseEventArgs? MouseEventArgs { get; set; } } diff --git a/Terminal.Gui/Input/Mouse/MouseBindings.cs b/Terminal.Gui/Input/Mouse/MouseBindings.cs index 93af18c25..8f2d5d066 100644 --- a/Terminal.Gui/Input/Mouse/MouseBindings.cs +++ b/Terminal.Gui/Input/Mouse/MouseBindings.cs @@ -15,21 +15,20 @@ public class MouseBindings public MouseBindings () { } /// Adds a to the collection. - /// + /// /// - public void Add (MouseEventArgs mouseEvent, MouseBinding binding) + public void Add (MouseEventArgs mouseEventArgs, MouseBinding binding) { - if (TryGet (mouseEvent, out MouseBinding _)) + if (TryGet (mouseEventArgs, out MouseBinding _)) { - throw new InvalidOperationException (@$"A binding for {mouseEvent} exists ({binding})."); + throw new InvalidOperationException (@$"A binding for {mouseEventArgs} exists ({binding})."); } - - // IMPORTANT: Add a COPY of the key. This is needed because ConfigurationManager.Apply uses DeepMemberWiseCopy + // IMPORTANT: Add a COPY of the mouseEventArgs. This is needed because ConfigurationManager.Apply uses DeepMemberWiseCopy // IMPORTANT: update the memory referenced by the key, and Dictionary uses caching for performance, and thus - // IMPORTANT: Apply will update the Dictionary with the new key, but the old key will still be in the dictionary. + // IMPORTANT: Apply will update the Dictionary with the new mouseEventArgs, but the old mouseEventArgs will still be in the dictionary. // IMPORTANT: See the ConfigurationManager.Illustrate_DeepMemberWiseCopy_Breaks_Dictionary test for details. - Bindings.Add (mouseEvent, binding); + Bindings.Add (mouseEventArgs, binding); } /// @@ -43,15 +42,16 @@ public class MouseBindings /// Commands are only ever applied to the current (i.e. this feature cannot be used to switch /// focus to another view and perform multiple commands there). /// - /// The mouse flags to check. + /// The mouse flags to check. /// - /// The command to invoked on the when is received. When - /// multiple commands are provided,they will be applied in sequence. The bound event will be + /// The command to invoked on the when is received. When + /// multiple commands are provided,they will be applied in sequence. The bound event + /// will be /// consumed if any took effect. /// - public void Add (MouseEventArgs mouseEvents, params Command [] commands) + public void Add (MouseEventArgs mouseEventArgs, params Command [] commands) { - if (mouseEvents.Flags == MouseFlags.None) + if (mouseEventArgs.Flags == MouseFlags.None) { throw new ArgumentException (@"Invalid MouseFlag", nameof (commands)); } @@ -61,12 +61,12 @@ public class MouseBindings throw new ArgumentException (@"At least one command must be specified", nameof (commands)); } - if (TryGet (mouseEvents, out MouseBinding binding)) + if (TryGet (mouseEventArgs, out MouseBinding binding)) { - throw new InvalidOperationException (@$"A binding for {mouseEvents} exists ({binding})."); + throw new InvalidOperationException (@$"A binding for {mouseEventArgs} exists ({binding})."); } - Add (mouseEvents, new MouseBinding (commands)); + Add (mouseEventArgs, new MouseBinding (commands, mouseEventArgs)); } // TODO: Add a dictionary comparer that ignores Scope @@ -74,15 +74,6 @@ public class MouseBindings /// The collection of objects. public Dictionary Bindings { get; } = new (); - /// - /// Gets the that are bound. - /// - /// - public IEnumerable GetBoundMouseEventArgs () - { - return Bindings.Keys; - } - /// Removes all objects from the collection. public void Clear () { Bindings.Clear (); } @@ -94,8 +85,8 @@ public class MouseBindings public void Clear (params Command [] command) { KeyValuePair [] kvps = Bindings - .Where (kvp => kvp.Value.Commands.SequenceEqual (command)) - .ToArray (); + .Where (kvp => kvp.Value.Commands.SequenceEqual (command)) + .ToArray (); foreach (KeyValuePair kvp in kvps) { @@ -104,27 +95,48 @@ public class MouseBindings } /// Gets the for the specified combination of . - /// + /// /// - public MouseBinding Get (MouseEventArgs mouseEvents) + public MouseBinding Get (MouseEventArgs mouseEventArgs) { - if (TryGet (mouseEvents, out MouseBinding binding)) + if (TryGet (mouseEventArgs, out MouseBinding binding)) { return binding; } - throw new InvalidOperationException ($"{mouseEvents} is not bound."); + throw new InvalidOperationException ($"{mouseEventArgs} is not bound."); } - /// Gets the array of s bound to if it exists. - /// The key to check. + /// + /// Gets combination of bound to the set of commands specified by + /// . + /// + /// The set of commands to search. /// - /// The array of s if is bound. An empty array + /// The combination of bound to the set of commands specified by + /// . An empty list if the set of caommands was not found. + /// + public IEnumerable GetAllMouseEventArgsFromCommands (params Command [] commands) + { + return Bindings.Where (a => a.Value.Commands.SequenceEqual (commands)).Select (a => a.Key); + } + + /// + /// Gets the that are bound. + /// + /// + public IEnumerable GetBoundMouseEventArgs () { return Bindings.Keys; } + + /// Gets the array of s bound to if it exists. + /// The key to check. + /// + /// The array of s if is bound. An empty + /// array /// if not. /// - public Command [] GetCommands (MouseEventArgs mouseEvents) + public Command [] GetCommands (MouseEventArgs mouseEventArgs) { - if (TryGet (mouseEvents, out MouseBinding bindings)) + if (TryGet (mouseEventArgs, out MouseBinding bindings)) { return bindings.Commands; } @@ -132,32 +144,30 @@ public class MouseBindings return []; } - /// Gets the first combination of bound to the set of commands specified by . + /// + /// Gets the first combination of bound to the set of commands specified by + /// . + /// /// The set of commands to search. - /// The first combination of bound to the set of commands specified by . if the set of caommands was not found. + /// + /// The first combination of bound to the set of commands specified by + /// . if the set of caommands was not found. + /// public MouseEventArgs? GetMouseEventArgsFromCommands (params Command [] commands) { return Bindings.FirstOrDefault (a => a.Value.Commands.SequenceEqual (commands)).Key; } - /// Gets combination of bound to the set of commands specified by . - /// The set of commands to search. - /// The combination of bound to the set of commands specified by . An empty list if the set of caommands was not found. - public IEnumerable GetAllMouseEventArgsFromCommands (params Command [] commands) - { - return Bindings.Where (a => a.Value.Commands.SequenceEqual (commands)).Select (a => a.Key); - } - /// Removes a from the collection. - /// - public void Remove (MouseEventArgs mouseEvents) + /// + public void Remove (MouseEventArgs mouseEventArgs) { - if (!TryGet (mouseEvents, out MouseBinding _)) + if (!TryGet (mouseEventArgs, out MouseBinding _)) { return; } - Bindings.Remove (mouseEvents); + Bindings.Remove (mouseEventArgs); } /// Replaces the commands already bound to a combination of . @@ -166,24 +176,27 @@ public class MouseBindings /// If the combination of is not already bound, it will be added. /// /// - /// The combination of bound to the command to be replaced. + /// The combination of bound to the command to be replaced. /// The set of commands to replace the old ones with. - public void ReplaceCommands (MouseEventArgs mouseEvents, params Command [] commands) + public void ReplaceCommands (MouseEventArgs mouseEventArgs, params Command [] commands) { - if (TryGet (mouseEvents, out MouseBinding binding)) + if (TryGet (mouseEventArgs, out MouseBinding binding)) { binding.Commands = commands; } else { - Add (mouseEvents, commands); + Add (mouseEventArgs, commands); } } /// Replaces a combination already bound to a set of s. /// /// The to be replaced. - /// The new to be used. If no action will be taken. + /// + /// The new to be used. If no action + /// will be taken. + /// public void ReplaceKey (MouseEventArgs oldMouseEventArgs, MouseEventArgs newMouseEventArgs) { if (!TryGet (oldMouseEventArgs, out MouseBinding _)) @@ -198,17 +211,16 @@ public class MouseBindings /// Gets the commands bound with the specified . /// - /// The key to check. + /// The key to check. /// /// When this method returns, contains the commands bound with the specified mouse flags, if the mouse flags are /// found; otherwise, null. This parameter is passed uninitialized. /// /// if the mouse flags are bound; otherwise . - public bool TryGet (MouseEventArgs mouseEvents, out MouseBinding binding) + public bool TryGet (MouseEventArgs mouseEventArgs, out MouseBinding binding) { + binding = new ([], mouseEventArgs); - binding = new ([]); - - return Bindings.TryGetValue (mouseEvents, out binding); + return Bindings.TryGetValue (mouseEventArgs, out binding); } } diff --git a/Terminal.Gui/View/View.Mouse.cs b/Terminal.Gui/View/View.Mouse.cs index 29edd7188..a897f2ef3 100644 --- a/Terminal.Gui/View/View.Mouse.cs +++ b/Terminal.Gui/View/View.Mouse.cs @@ -360,7 +360,7 @@ public partial class View // Mouse APIs // Always invoke Select command on MouseClick // By default, this will raise Selecting/OnSelecting - Subclasses can override this via AddCommand (Command.Select ...). - args.Handled = InvokeCommand (Command.Select, new ([Command.Select], KeyBindingScope.Focused, null, args)) == true; + args.Handled = InvokeCommand (Command.Select, new ([Command.Select], args)) == true; return args.Handled; } @@ -666,15 +666,15 @@ public partial class View // Mouse APIs if (start is not Adornment) { - if (start.Margin is {} && start.Margin.Contains (currentLocation)) + if (start.Margin is { } && start.Margin.Contains (currentLocation)) { found = start.Margin; } - else if (start.Border is {} && start.Border.Contains (currentLocation)) + else if (start.Border is { } && start.Border.Contains (currentLocation)) { found = start.Border; } - else if (start.Padding is { } && start.Padding.Contains(currentLocation)) + else if (start.Padding is { } && start.Padding.Contains (currentLocation)) { found = start.Padding; } diff --git a/Terminal.Gui/Views/Button.cs b/Terminal.Gui/Views/Button.cs index 5036c07bf..79118a5c9 100644 --- a/Terminal.Gui/Views/Button.cs +++ b/Terminal.Gui/Views/Button.cs @@ -72,18 +72,14 @@ public class Button : View, IDesignable private bool? HandleHotKeyCommand (ICommandContext commandContext) { - if (commandContext is not CommandContext ctx) - { - return false; - } bool cachedIsDefault = IsDefault; // Supports "Swap Default" in Buttons scenario where IsDefault changes - if (RaiseSelecting (ctx) is true) + if (RaiseSelecting (commandContext) is true) { return true; } - bool? handled = RaiseAccepting (ctx); + bool? handled = RaiseAccepting (commandContext); if (handled == true) { @@ -97,7 +93,7 @@ public class Button : View, IDesignable // If Accept was not handled... if (cachedIsDefault && SuperView is { }) { - return SuperView.InvokeCommand (Command.Accept, ctx.Binding); + return SuperView.InvokeCommand (Command.Accept); } return false; @@ -137,7 +133,7 @@ public class Button : View, IDesignable } // TODO: With https://github.com/gui-cs/Terminal.Gui/issues/3778 we won't have to pass data: - e.Handled = InvokeCommand (Command.HotKey, new KeyBinding([Command.HotKey], KeyBindingScope.HotKey, this, null)) == true; + e.Handled = InvokeCommand (Command.HotKey, new KeyBinding ([Command.HotKey], KeyBindingScope.HotKey, this, null)) == true; } private void Button_TitleChanged (object sender, EventArgs e) diff --git a/Terminal.Gui/Views/CheckBox.cs b/Terminal.Gui/Views/CheckBox.cs index d2a4d60c9..fcdc9beb8 100644 --- a/Terminal.Gui/Views/CheckBox.cs +++ b/Terminal.Gui/Views/CheckBox.cs @@ -24,7 +24,14 @@ public class CheckBox : View AddCommand (Command.Select, AdvanceAndSelect); // Hotkey - Advance state and raise Select event - DO NOT raise Accept - AddCommand (Command.HotKey, AdvanceAndSelect); + AddCommand (Command.HotKey, ctx => + { + if (RaiseHandlingHotKey () is true) + { + return true; + } + return AdvanceAndSelect (ctx); + }); // Accept (Enter key) - Raise Accept event - DO NOT advance state AddCommand (Command.Accept, RaiseAccepting); @@ -34,13 +41,8 @@ public class CheckBox : View HighlightStyle = DefaultHighlightStyle; } - private bool? AdvanceAndSelect (ICommandContext commandContext) + private bool? AdvanceAndSelect (ICommandContext? commandContext) { - if (commandContext is not CommandContext ctx) - { - return false; - } - bool? cancelled = AdvanceCheckState (); if (cancelled is true) @@ -48,12 +50,12 @@ public class CheckBox : View return true; } - if (RaiseSelecting (ctx) is true) + if (RaiseSelecting (commandContext) is true) { return true; } - return ctx.Command == Command.HotKey ? cancelled : cancelled is false; + return commandContext?.Command == Command.HotKey ? cancelled : cancelled is false; } private void Checkbox_TitleChanged (object? sender, EventArgs e) diff --git a/Terminal.Gui/Views/ColorPicker.16.cs b/Terminal.Gui/Views/ColorPicker.16.cs index f699f5686..bce9dcf28 100644 --- a/Terminal.Gui/Views/ColorPicker.16.cs +++ b/Terminal.Gui/Views/ColorPicker.16.cs @@ -69,11 +69,7 @@ public class ColorPicker16 : View /// private bool MoveDown (ICommandContext commandContext) { - if (commandContext is not CommandContext ctx) - { - return false; - } - if (RaiseSelecting (ctx) == true) + if (RaiseSelecting (commandContext) == true) { return true; } @@ -89,11 +85,7 @@ public class ColorPicker16 : View /// private bool MoveLeft (ICommandContext commandContext) { - if (commandContext is not CommandContext ctx) - { - return false; - } - if (RaiseSelecting (ctx) == true) + if (RaiseSelecting (commandContext) == true) { return true; } @@ -110,11 +102,7 @@ public class ColorPicker16 : View /// private bool MoveRight (ICommandContext commandContext) { - if (commandContext is not CommandContext ctx) - { - return false; - } - if (RaiseSelecting (ctx) == true) + if (RaiseSelecting (commandContext) == true) { return true; } @@ -130,11 +118,7 @@ public class ColorPicker16 : View /// private bool MoveUp (ICommandContext commandContext) { - if (commandContext is not CommandContext ctx) - { - return false; - } - if (RaiseSelecting (ctx) == true) + if (RaiseSelecting (commandContext) == true) { return true; } @@ -206,9 +190,9 @@ public class ColorPicker16 : View { bool set = false; - if (ctx is CommandContext { Binding: { } } mouseCommandContext) + if (ctx is CommandContext { Binding.MouseEventArgs: { } } mouseCommandContext) { - Cursor = new (mouseCommandContext.Binding.Position.X / _boxWidth, mouseCommandContext.Binding.Position.Y / _boxHeight); + Cursor = new (mouseCommandContext.Binding.MouseEventArgs.Position.X / _boxWidth, mouseCommandContext.Binding.MouseEventArgs.Position.Y / _boxHeight); set = true; } return RaiseAccepting (ctx) == true || set; diff --git a/Terminal.Gui/Views/ComboBox.cs b/Terminal.Gui/Views/ComboBox.cs index 2e3763a9b..7b30e09cf 100644 --- a/Terminal.Gui/Views/ComboBox.cs +++ b/Terminal.Gui/Views/ComboBox.cs @@ -401,10 +401,6 @@ public class ComboBox : View, IDesignable private bool ActivateSelected (ICommandContext commandContext) { - if (commandContext is not CommandContext ctx) - { - return false; - } if (HasItems ()) { if (SelectText ()) @@ -412,7 +408,7 @@ public class ComboBox : View, IDesignable return false; } - return RaiseAccepting (ctx) == true; + return RaiseAccepting (commandContext) == true; } return false; diff --git a/Terminal.Gui/Views/Label.cs b/Terminal.Gui/Views/Label.cs index 3ada1f11e..e277357f4 100644 --- a/Terminal.Gui/Views/Label.cs +++ b/Terminal.Gui/Views/Label.cs @@ -62,10 +62,6 @@ public class Label : View, IDesignable private bool? InvokeHotKeyOnNext (ICommandContext commandContext) { - if (commandContext is not CommandContext ctx) - { - return false; - } if (RaiseHandlingHotKey () == true) { return true; @@ -82,7 +78,8 @@ public class Label : View, IDesignable if (me != -1 && me < SuperView?.Subviews.Count - 1) { - return SuperView?.Subviews [me + 1].InvokeCommand (Command.HotKey, ctx.Binding) == true; + + return SuperView?.Subviews [me + 1].InvokeCommand (Command.HotKey) == true; } return false; diff --git a/Terminal.Gui/Views/Shortcut.cs b/Terminal.Gui/Views/Shortcut.cs index 069519494..5305ea317 100644 --- a/Terminal.Gui/Views/Shortcut.cs +++ b/Terminal.Gui/Views/Shortcut.cs @@ -302,20 +302,17 @@ public class Shortcut : View, IOrientation, IDesignable private bool? DispatchCommand (ICommandContext? commandContext) { - if (commandContext is not CommandContext ctx) - { - return false; - } + CommandContext? keyCommandContext = commandContext is CommandContext ? (CommandContext)commandContext : default; - if (ctx.Binding.Data != this) + if (keyCommandContext?.Binding.Data != this) { // Invoke Select on the command view to cause it to change state if it wants to // If this causes CommandView to raise Accept, we eat it - ctx.Binding = ctx.Binding with { Data = this }; - CommandView.InvokeCommand (Command.Select, ctx); + keyCommandContext = keyCommandContext!.Value with { Binding = keyCommandContext.Value.Binding with { Data = this } }; + CommandView.InvokeCommand (Command.Select, keyCommandContext); } - if (RaiseSelecting (ctx) is true) + if (RaiseSelecting (keyCommandContext) is true) { return true; } @@ -325,14 +322,14 @@ public class Shortcut : View, IOrientation, IDesignable var cancel = false; - cancel = RaiseAccepting (ctx) is true; + cancel = RaiseAccepting (commandContext) is true; if (cancel) { return true; } - if (ctx.Command != Command.Accept) + if (commandContext?.Command != Command.Accept) { // return false; } @@ -347,7 +344,7 @@ public class Shortcut : View, IOrientation, IDesignable if (_targetView is { }) { - _targetView.InvokeCommand (Command, ctx); + _targetView.InvokeCommand (Command, commandContext); } return cancel; @@ -498,7 +495,8 @@ public class Shortcut : View, IOrientation, IDesignable void CommandViewOnSelecting (object? sender, CommandEventArgs e) { - if (e.Context is CommandContext keyCommandContext && keyCommandContext.Binding.Data != this) + if ((e.Context is CommandContext keyCommandContext && keyCommandContext.Binding.Data != this) || + e.Context is CommandContext) { // Forward command to ourselves InvokeCommand (Command.Select, new ([Command.Select], KeyBindingScope.Focused, null, this)); diff --git a/Terminal.Gui/Views/Slider.cs b/Terminal.Gui/Views/Slider.cs index c0cef3915..2008f22e4 100644 --- a/Terminal.Gui/Views/Slider.cs +++ b/Terminal.Gui/Views/Slider.cs @@ -850,7 +850,7 @@ public class Slider : View, IOrientation if (IsInitialized) { - normalAttr = GetNormalColor(); + normalAttr = GetNormalColor (); setAttr = Style.SetChar.Attribute ?? GetHotNormalColor (); } @@ -1787,13 +1787,9 @@ public class Slider : View, IOrientation internal bool Accept (ICommandContext commandContext) { - if (commandContext is not CommandContext ctx) - { - return false; - } SetFocusedOption (); - return RaiseAccepting (ctx) == true; + return RaiseAccepting (commandContext) == true; } internal bool MovePlus () diff --git a/Terminal.Gui/Views/TextView.cs b/Terminal.Gui/Views/TextView.cs index 35b5f67aa..065a34609 100644 --- a/Terminal.Gui/Views/TextView.cs +++ b/Terminal.Gui/Views/TextView.cs @@ -3719,7 +3719,7 @@ public class TextView : View col = _wrapManager.GetModelColFromWrappedLines (CurrentRow, CurrentColumn); } - UnwrappedCursorPosition?.Invoke (this, new Point (row.Value, col.Value)); + UnwrappedCursorPosition?.Invoke (this, new Point (col.Value, row.Value)); } /// Paste the clipboard contents into the current selected position. @@ -6143,12 +6143,8 @@ public class TextView : View Paste (); } - private bool ProcessEnterKey (ICommandContext commandContext) + private bool ProcessEnterKey (ICommandContext? commandContext) { - if (commandContext is not CommandContext ctx) - { - return false; - } ResetColumnTrack (); if (_isReadOnly) @@ -6160,7 +6156,7 @@ public class TextView : View { // By Default pressing ENTER should be ignored (OnAccept will return false or null). Only cancel if the // event was fired and set Cancel = true. - return RaiseAccepting (ctx) is null or false; + return RaiseAccepting (commandContext) is null or false; } SetWrapModel (); diff --git a/Terminal.Gui/Views/TreeView/TreeView.cs b/Terminal.Gui/Views/TreeView/TreeView.cs index c7f1c1f6f..74de1047b 100644 --- a/Terminal.Gui/Views/TreeView/TreeView.cs +++ b/Terminal.Gui/Views/TreeView/TreeView.cs @@ -464,12 +464,8 @@ public class TreeView : View, ITreeView where T : class /// if was fired. public bool? ActivateSelectedObjectIfAny (ICommandContext commandContext) { - if (commandContext is not CommandContext ctx) - { - return false; - } // By default, Command.Accept calls OnAccept, so we need to call it here to ensure that the event is fired. - if (RaiseAccepting (ctx) == true) + if (RaiseAccepting (commandContext) == true) { return true; } diff --git a/UnitTests/Views/AllViewsTests.cs b/UnitTests/Views/AllViewsTests.cs index ccad6302f..bc2044361 100644 --- a/UnitTests/Views/AllViewsTests.cs +++ b/UnitTests/Views/AllViewsTests.cs @@ -188,25 +188,21 @@ public class AllViewsTests (ITestOutputHelper output) : TestsAllViews view.HotKey = Key.T; } - var selectingCount = 0; - view.Selecting += (s, e) => selectingCount++; - var acceptedCount = 0; view.Accepting += (s, e) => { acceptedCount++; }; - var hotkeyHandledCount = 0; + var handlingHotKeyCount = 0; view.HandlingHotKey += (s, e) => { - hotkeyHandledCount++; + handlingHotKeyCount++; }; if (view.InvokeCommand (Command.HotKey) == true) { - Assert.Equal (1, hotkeyHandledCount); - Assert.Equal (0, selectingCount); + Assert.Equal (1, handlingHotKeyCount); Assert.Equal (0, acceptedCount); } }