Allow PACKET key on MultiSelectionPrompt

This commit is contained in:
nilaoda 2022-10-13 22:46:07 +08:00 committed by Patrik Svensson
parent f6a7c96413
commit 8fa53f8fb1
2 changed files with 2 additions and 2 deletions

View File

@ -160,7 +160,7 @@ public sealed class MultiSelectionPrompt<T> : IPrompt<List<T>>, IListPromptStrat
return ListPromptInputResult.Submit; return ListPromptInputResult.Submit;
} }
if (key.Key == ConsoleKey.Spacebar) if (key.Key == ConsoleKey.Spacebar || key.Key == ConsoleKey.Packet)
{ {
var current = state.Items[state.Index]; var current = state.Items[state.Index];
var select = !current.IsSelected; var select = !current.IsSelected;

View File

@ -93,7 +93,7 @@ public sealed class SelectionPrompt<T> : IPrompt<T>, IListPromptStrategy<T>
/// <inheritdoc/> /// <inheritdoc/>
ListPromptInputResult IListPromptStrategy<T>.HandleInput(ConsoleKeyInfo key, ListPromptState<T> state) ListPromptInputResult IListPromptStrategy<T>.HandleInput(ConsoleKeyInfo key, ListPromptState<T> state)
{ {
if (key.Key == ConsoleKey.Enter || key.Key == ConsoleKey.Spacebar) if (key.Key == ConsoleKey.Enter || key.Key == ConsoleKey.Spacebar || key.Key == ConsoleKey.Packet)
{ {
// Selecting a non leaf in "leaf mode" is not allowed // Selecting a non leaf in "leaf mode" is not allowed
if (state.Current.IsGroup && Mode == SelectionMode.Leaf) if (state.Current.IsGroup && Mode == SelectionMode.Leaf)