Fixes #3144. TextView Autocomplete does not insert capital letters (#3145)

* Fixes #3144. TextView Autocomplete does not insert capital letters

* Fixes #3144. Fix unit test for fix of TextView Autocomplete does not insert capital letters
This commit is contained in:
joebart457
2024-01-08 11:11:11 -08:00
committed by GitHub
parent eb45036848
commit 3150d43979
2 changed files with 4 additions and 4 deletions

View File

@@ -3026,14 +3026,14 @@ public class TextView : View {
public void InsertText (string toAdd)
{
foreach (char ch in toAdd) {
KeyCode key;
Key key;
try {
key = (KeyCode)ch;
key = new Key(ch);
} catch (Exception) {
throw new ArgumentException ($"Cannot insert character '{ch}' because it does not map to a Key");
}
InsertText (new Key (key));
InsertText (key);
if (NeedsDisplay) {
Adjust ();

View File

@@ -153,7 +153,7 @@ namespace Terminal.Gui.TextTests {
Assert.Equal (3, g.AllSuggestions.Count);
Assert.True (tv.NewKeyDownEvent (new (tv.Autocomplete.SelectionKey)));
tv.PositionCursor ();
Assert.Equal ($"fortunately Fortunately super feature.", tv.Text);
Assert.Equal ($"Fortunately Fortunately super feature.", tv.Text);
Assert.Equal (new Point (11, 0), tv.CursorPosition);
Assert.Empty (tv.Autocomplete.Suggestions);
Assert.Equal (3, g.AllSuggestions.Count);