Revert "Simplify wxTextCtrl::GetLastPosition"

This reverts commit c4e1fb4ef9.

Last position is not necessarily the number of characters in the buffer,
rich edit controls still store the text using CR LF between lines, but
GetLastPosition() should return the position as if they used only LF to
be consistent with all the other positions in these controls and
changing this broke existing code passing GetLastPosition() to other
functions taking position.
This commit is contained in:
Vadim Zeitlin
2017-08-25 01:12:17 +02:00
parent e74fb5effe
commit 49ebac7102

View File

@@ -1334,7 +1334,12 @@ wxTextPos wxTextCtrl::GetLastPosition() const
{
if ( IsMultiLine() )
{
return ::GetWindowTextLength(GetHwnd());
int numLines = GetNumberOfLines();
long posStartLastLine = XYToPosition(0, numLines - 1);
long lenLastLine = GetLengthOfLineContainingPos(posStartLastLine);
return posStartLastLine + lenLastLine;
}
return wxTextEntry::GetLastPosition();