diff --git a/Terminal.Gui/Views/TextView.cs b/Terminal.Gui/Views/TextView.cs index ef0132154..6ed4521d7 100644 --- a/Terminal.Gui/Views/TextView.cs +++ b/Terminal.Gui/Views/TextView.cs @@ -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 (); diff --git a/UnitTests/Text/AutocompleteTests.cs b/UnitTests/Text/AutocompleteTests.cs index 5f853abba..ad7bc6e09 100644 --- a/UnitTests/Text/AutocompleteTests.cs +++ b/UnitTests/Text/AutocompleteTests.cs @@ -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);