Repository: spectreconsole/spectre.console (2026-04-07T14:55:42Z)

Issue:
Ignore the case of the input for TextPrompt (select from multiple choices)
```
        var feedback = AnsiConsole.Prompt(
            new TextPrompt<string>("Was the tool helpful in solving the error?")
              .AddChoices(["Yes", "Partially", "No"]));
```

Currently the input is case-sensitive

<img width="475" height="32" alt="Image" src="https://github.com/user-attachments/assets/95396100-72da-4ddb-81a3-44951eab8563" />

How to make it not case-sensitive? Is it possible?


Discussion:
@nbdinara Sounds reasonable! Do you want to fix this?
Hi! I'd like to take a crack at this if that's alright.



Patch:
diff --git a/src/Spectre.Console/Prompts/TextPrompt.cs b/src/Spectre.Console/Prompts/TextPrompt.cs
index 5418ef8b9..4dbcf71b0 100644
--- a/src/Spectre.Console/Prompts/TextPrompt.cs
+++ b/src/Spectre.Console/Prompts/TextPrompt.cs
@@ -109,7 +109,7 @@ public sealed class TextPrompt<T> : IPrompt<T>, IHasCulture
     public TextPrompt(string prompt, StringComparer? comparer = null)
     {
         _prompt = prompt ?? throw new System.ArgumentNullException(nameof(prompt));
-        _comparer = comparer;
+        _comparer = comparer ?? StringComparer.OrdinalIgnoreCase;
     }
 
     /// <summary>


Test patch:
diff --git a/src/Spectre.Console.Tests/Unit/Prompts/TextPromptTests.cs b/src/Spectre.Console.Tests/Unit/Prompts/TextPromptTests.cs
index 80a18b563..0f09591e7 100644
--- a/src/Spectre.Console.Tests/Unit/Prompts/TextPromptTests.cs
+++ b/src/Spectre.Console.Tests/Unit/Prompts/TextPromptTests.cs
@@ -453,4 +453,24 @@ public Task Should_Clear_Prompt_Line_When_ClearOnFinish_Is_Enabled()
         // Then
         return Verifier.Verify(console.Output);
     }
+
+    [Theory]
+    [InlineData("yes")]
+    [InlineData("Yes")]
+    [InlineData("YES")]
+    public async Task Uses_case_insensitive_comparison_when_no_comparer_is_passed(string input)
+    {
+        // Given
+        var console = new TestConsole { EmitAnsiSequences = true, };
+        console.Input.PushTextWithEnter(input);
+
+        var prompt = new TextPrompt<string>("Was the tool helpful?")
+            .AddChoices(["Yes", "Partially", "No"]);
+
+        // When
+        var result = await console.PromptAsync(prompt);
+
+        // Then
+        result.ShouldBe("Yes");
+    }
 }
\ No newline at end of file