fix(TextPrompt): prevent ArgumentOutOfRangeException for non-ASCII default values - #2178
Closed
Moha-sami wants to merge 1 commit into
Closed
fix(TextPrompt): prevent ArgumentOutOfRangeException for non-ASCII default values#2178Moha-sami wants to merge 1 commit into
Moha-sami wants to merge 1 commit into
Conversation
Contributor
|
@Moha-sami That issue you mention had been closed, and is not related to this change. |
Contributor
|
This PR needs a related issue. Also, are you sure no AI has been used in this change? We need to know if so. |
Author
|
No But I'm new to This some how It's ok Will Just remove it my contribution was nothing anyway Good Luck |
Contributor
|
It's OK being new, but in the future, try following the contribution guidelines for projects that you want to contribute to. |
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 #2152
Changes
Problem
When using
TextPromptwithEditableDefaultValue(true)containing non-ASCII or Unicode characters (e.g."日本語"or"ä"),AnsiConsoleExtensions.Input.cspassed(ConsoleKey)chtoConsoleKeyInfo, which throwsArgumentOutOfRangeExceptionin .NET whenConsoleKey > 255.Solution
AnsiConsoleExtensions.Input.csto check(int)ch <= 255 ? (ConsoleKey)ch : (ConsoleKey)0, preventing out-of-range exceptions while maintaining full Unicode string processing.Should_Not_Throw_When_Editable_Default_Value_Contains_Non_Ascii_CharactersinTextPromptTests.cs.