diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index fda9d0207d..a00d54dcd6 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -1291,6 +1291,13 @@ wxString wxTextCtrl::GetLineText(long lineNo) const } #endif // wxUSE_RICHEDIT + // remove the '\n' at the end, if any (this is how this function is + // supposed to work according to the docs) + if ( buf[len - 1] == _T('\n') ) + { + len--; + } + buf[len] = 0; tmp.SetLength(len); }