From c4e1fb4ef939a8297eb017f89df06f5f6f72c539 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Sat, 29 Jul 2017 20:53:14 +0200 Subject: [PATCH] Simplify wxTextCtrl::GetLastPosition Last position is just the number of characters in the buffer. --- src/msw/textctrl.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index 294ecc8232..ac6c64be55 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -1334,12 +1334,7 @@ wxTextPos wxTextCtrl::GetLastPosition() const { if ( IsMultiLine() ) { - int numLines = GetNumberOfLines(); - long posStartLastLine = XYToPosition(0, numLines - 1); - - long lenLastLine = GetLengthOfLineContainingPos(posStartLastLine); - - return posStartLastLine + lenLastLine; + return ::GetWindowTextLength(GetHwnd()); } return wxTextEntry::GetLastPosition();