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:
@@ -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();
|
||||
|
Reference in New Issue
Block a user