Fixes #2196. TextView: Setting Text places cursor at beginning, unlike TextField (#2572)

* Fixes #2196. TextView: Setting Text places cursor at beginning, unlike TextField

* Change all private members to have the _prefix.

* Renamed local member to prevLayoutStyle.

* Helper function for SetNeedsDisplay.
This commit is contained in:
BDisp
2023-04-29 22:42:53 +01:00
committed by GitHub
parent 130fc5713d
commit be67e0f09f
4 changed files with 855 additions and 809 deletions

View File

@@ -1588,5 +1588,15 @@ Les Miśerables", output);
tf.ProcessKey (new KeyEvent (Key.CtrlMask | Key.CursorRight, new KeyModifiers () { Ctrl = true }));
Assert.Equal (22, tf.CursorPosition);
}
[Fact, TextFieldTestsAutoInitShutdown]
public void Cursor_Position_Initialization ()
{
Assert.False (_textField.IsInitialized);
Assert.Equal (32, _textField.CursorPosition);
Assert.Equal (0, _textField.SelectedLength);
Assert.Null (_textField.SelectedText);
Assert.Equal ("TAB to jump between text fields.", _textField.Text);
}
}
}

View File

@@ -6934,5 +6934,19 @@ This is the second line.
newPos = model.WordForward (4, 0);
Assert.Null (newPos);
}
[Fact, TextViewTestsAutoInitShutdown]
public void Cursor_Position_Multiline_False_Initialization ()
{
Assert.False (_textView.IsInitialized);
Assert.True (_textView.Multiline);
_textView.Multiline = false;
Assert.Equal (32, _textView.CursorPosition.X);
Assert.Equal (0, _textView.CursorPosition.Y);
Assert.Equal (0, _textView.SelectedLength);
Assert.Equal ("", _textView.SelectedText);
Assert.Equal ("TAB to jump between text fields.", _textView.Text);
}
}
}