]> git.saurik.com Git - wxWidgets.git/commitdiff
chop off the unwanted \r from GetLineText() return value for richedit 2.0 controls...
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 10 Sep 2007 11:16:04 +0000 (11:16 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 10 Sep 2007 11:16:04 +0000 (11:16 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48627 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/textctrl.cpp

index 5b64187e79a2e242fc049b760eb1e760a7b5a2f6..97c0559a8b0d4a428c7d17dcca8c81719bb865ed 100644 (file)
@@ -1712,9 +1712,16 @@ wxString wxTextCtrl::GetLineText(long lineNo) const
             // should never see it
             if ( buf[len - 2] == _T('\r') && buf[len - 1] == _T('\n') )
             {
+                // richedit 1.0 uses "\r\n" as line terminator, so remove "\r"
+                // here and "\n" below
                 buf[len - 2] = _T('\n');
                 len--;
             }
+            else if ( buf[len - 1] == _T('\r') )
+            {
+                // richedit 2.0+ uses only "\r", replace it with "\n"
+                buf[len - 1] = _T('\n');
+            }
         }
 #endif // wxUSE_RICHEDIT