mirror of
https://github.com/spectreconsole/spectre.console.git
synced 2026-01-02 01:03:32 +01:00
Fix space triggering selection when items in selection list have a space. (#1881)
* Changes Search in SelectionPrompt to accept Space Key as text --------- Co-authored-by: Philipp <30900810+DerReparator@users.noreply.github.com>
This commit is contained in:
@@ -109,7 +109,9 @@ public sealed class SelectionPrompt<T> : IPrompt<T>, IListPromptStrategy<T>
|
||||
/// <inheritdoc/>
|
||||
ListPromptInputResult IListPromptStrategy<T>.HandleInput(ConsoleKeyInfo key, ListPromptState<T> state)
|
||||
{
|
||||
if (key.Key == ConsoleKey.Enter || key.Key == ConsoleKey.Spacebar || key.Key == ConsoleKey.Packet)
|
||||
if (key.Key == ConsoleKey.Enter
|
||||
|| key.Key == ConsoleKey.Packet
|
||||
|| (!state.SearchEnabled && key.Key == ConsoleKey.Spacebar))
|
||||
{
|
||||
// Selecting a non leaf in "leaf mode" is not allowed
|
||||
if (state.Current.IsGroup && Mode == SelectionMode.Leaf)
|
||||
|
||||
Reference in New Issue
Block a user