From 8fa53f8fb19fbb4fb6e330d8d127519c4a0b19b3 Mon Sep 17 00:00:00 2001 From: nilaoda Date: Thu, 13 Oct 2022 22:46:07 +0800 Subject: [PATCH] Allow `PACKET` key on MultiSelectionPrompt --- src/Spectre.Console/Prompts/MultiSelectionPrompt.cs | 2 +- src/Spectre.Console/Prompts/SelectionPrompt.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Spectre.Console/Prompts/MultiSelectionPrompt.cs b/src/Spectre.Console/Prompts/MultiSelectionPrompt.cs index 20dbc71..8c8626b 100644 --- a/src/Spectre.Console/Prompts/MultiSelectionPrompt.cs +++ b/src/Spectre.Console/Prompts/MultiSelectionPrompt.cs @@ -160,7 +160,7 @@ public sealed class MultiSelectionPrompt : IPrompt>, IListPromptStrat return ListPromptInputResult.Submit; } - if (key.Key == ConsoleKey.Spacebar) + if (key.Key == ConsoleKey.Spacebar || key.Key == ConsoleKey.Packet) { var current = state.Items[state.Index]; var select = !current.IsSelected; diff --git a/src/Spectre.Console/Prompts/SelectionPrompt.cs b/src/Spectre.Console/Prompts/SelectionPrompt.cs index 1622b6e..5835c4a 100644 --- a/src/Spectre.Console/Prompts/SelectionPrompt.cs +++ b/src/Spectre.Console/Prompts/SelectionPrompt.cs @@ -93,7 +93,7 @@ public sealed class SelectionPrompt : IPrompt, IListPromptStrategy /// ListPromptInputResult IListPromptStrategy.HandleInput(ConsoleKeyInfo key, ListPromptState 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 if (state.Current.IsGroup && Mode == SelectionMode.Leaf)