Simplify wxTextCtrl::GetLastPosition

Last position is just the number of characters in the buffer.
This commit is contained in:
Artur Wieczorek
2017-07-29 20:53:14 +02:00
parent 8d94d4d9d3
commit c4e1fb4ef9

View File

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