spectre.console icon indicating copy to clipboard operation
spectre.console copied to clipboard

Esc Key to exit selection

Open 0xStuart opened this issue 2 years ago • 5 comments

There is an "Abort" input selection, but it is not used. https://github.com/spectreconsole/spectre.console/blob/eb6a9d8d047266b1317cdbed87c35f68996b9f0f/src/Spectre.Console/Prompts/List/ListPromptInputResult.cs#L8

Optionally tie that to the Esc Key, so that you can have nested menus.


Please upvote :+1: this issue if you are interested in it.

0xStuart avatar Jun 25 '22 14:06 0xStuart

I would like to try out this one!

BenjaminMichaelis avatar Oct 01 '22 16:10 BenjaminMichaelis

Absolutely. Knock yourself out! 😄

patriksvensson avatar Oct 01 '22 19:10 patriksvensson

Just to clarify on the scope of this, is all that is needed here to simply be returning this input result or also to do some handling of the escape case? And also is this abort wanted as a return option for all prompts or just the multi selection as I see that nesting was mentioned?

BenjaminMichaelis avatar Oct 04 '22 23:10 BenjaminMichaelis

I have a menu list, which links to further menus, so you can drill down to the option you want. At the moment, there is no way to go back to the previous menu, unless you add "back" as a menu item. Ideally, I would like to capture the Esc key.

0xStuart avatar Oct 06 '22 16:10 0xStuart

@0xStuart I've accomplished this by using the IAnsiConsole everywhere, and decorating the input with my implementation that intercepts keys globally.

nth-commit avatar Jul 26 '23 19:07 nth-commit