mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-01 16:59:35 +01:00
Fixes #2429. Error when replacing a word in textView.
This commit is contained in:
@@ -949,7 +949,7 @@ namespace Terminal.Gui.ViewTests {
|
||||
Assert.Equal (0, _textView.CursorPosition.X);
|
||||
Assert.Equal (0, _textView.CursorPosition.Y);
|
||||
Assert.Equal ("This is the second line.", _textView.Text.ToString ());
|
||||
Assert.Equal ($"This is the first line.{Environment.NewLine}", Clipboard.Contents.ToString());
|
||||
Assert.Equal ($"This is the first line.{Environment.NewLine}", Clipboard.Contents.ToString ());
|
||||
break;
|
||||
case 2:
|
||||
_textView.ProcessKey (new KeyEvent (Key.K | Key.CtrlMask, new KeyModifiers ()));
|
||||
@@ -985,7 +985,7 @@ namespace Terminal.Gui.ViewTests {
|
||||
_textView.ProcessKey (new KeyEvent (Key.K | Key.AltMask, new KeyModifiers ()));
|
||||
Assert.Equal (0, _textView.CursorPosition.X);
|
||||
Assert.Equal (1, _textView.CursorPosition.Y);
|
||||
Assert.Equal ($"This is the first line.{Environment.NewLine}", _textView.Text.ToString());
|
||||
Assert.Equal ($"This is the first line.{Environment.NewLine}", _textView.Text.ToString ());
|
||||
Assert.Equal ($"This is the second line.", Clipboard.Contents.ToString ());
|
||||
break;
|
||||
case 1:
|
||||
@@ -6815,5 +6815,17 @@ This is the second line.
|
||||
Assert.Equal (1, eventcount);
|
||||
Assert.Equal ($"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}", tv.Text);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReplaceAllText_Does_Not_Throw_Exception ()
|
||||
{
|
||||
var textToFind = "hello! hello!";
|
||||
var textToReplace = "hello!";
|
||||
var tv = new TextView () { Width = 20, Height = 3, Text = textToFind };
|
||||
|
||||
var exception = Record.Exception (() => tv.ReplaceAllText (textToFind, false, false, textToReplace));
|
||||
Assert.Null (exception);
|
||||
Assert.Equal (textToReplace, tv.Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user