Fixes #2653. TextField is using the UTF8 encoding to handle substring not compatible with string. (#2654)

This commit is contained in:
BDisp
2023-05-22 05:18:18 +01:00
committed by GitHub
parent 0ea7a871ce
commit ef6f355f50
3 changed files with 39 additions and 16 deletions

View File

@@ -914,7 +914,7 @@ namespace Terminal.Gui.ViewsTests {
}
[Fact]
[AutoInitShutdown(useFakeClipboard:true)]
[AutoInitShutdown (useFakeClipboard: true)]
public void KeyBindings_Command ()
{
var tf = new TextField ("This is a test.") { Width = 20 };
@@ -1598,5 +1598,17 @@ Les Miśerables", output);
Assert.Null (_textField.SelectedText);
Assert.Equal ("TAB to jump between text fields.", _textField.Text);
}
[Fact, TextFieldTestsAutoInitShutdown]
public void Copy_Paste_Surrogate_Pairs ()
{
_textField.Text = "TextField with some more test text. Unicode shouldn't 𝔹A𝔽!";
_textField.SelectAll ();
_textField.Cut ();
Assert.Equal ("TextField with some more test text. Unicode shouldn't 𝔹A𝔽!", Application.Driver.Clipboard.GetClipboardData ());
Assert.Equal (string.Empty, _textField.Text);
_textField.Paste ();
Assert.Equal ("TextField with some more test text. Unicode shouldn't 𝔹A𝔽!", _textField.Text);
}
}
}