Text prompt editable default#2016
Merged
patriksvensson merged 8 commits intospectreconsole:mainfrom Mar 11, 2026
Merged
Conversation
Contributor
Author
|
@microsoft-github-policy-service agree |
Contributor
|
@MapelSiroup PR is failing to build |
Contributor
Author
Should be good now, i hadn't noticed the failed build 👍 |
patriksvensson
requested changes
Feb 23, 2026
Contributor
|
@MapelSiroup Seems to be a merge conflict now that needs to be resolved |
patriksvensson
requested changes
Mar 4, 2026
patriksvensson
approved these changes
Mar 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #
Changes
This PR allows the insertion of the default value inside text field/input buffer making it editable and already available instead of the current DefaultValue behavior to simply set the text variable with the default when empty.
TextPrompt.cs: Added abool DefaultInput { get; set; }property and, when showing the prompt, if enabled the default value is placed into the editable input field.TextPromptExtensions.cs: Added matching extensionDefaultInput<T>(this TextPrompt<T> obj, bool state)to enable/disable the editable default behavior when creating TextPrompts.AnsiConsoleExtensions.Input.cs: Added a new ReadLine() overload that accepts aninitialInput (string?)and enqueues a ConsoleKeyInfo per character. The overload consumes those queued key events first, then falls back toconsole.Input.ReadKeyAsync().TextPromptTests.cs: Added a unit testShould_Return_Error_If_Default_Choice_Invalidthat checks the default input system (Testing the validity checks whether the input matches a valid choice in the list).Affected files:
Please upvote 👍 this pull request if you are interested in it.