]> git.saurik.com Git - wxWidgets.git/commitdiff
don't return \r from GetLineText()
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 31 Aug 2003 21:02:21 +0000 (21:02 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 31 Aug 2003 21:02:21 +0000 (21:02 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23333 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/textctrl.cpp

index 36b2717034883eab7b764d33369a1686bb7bf32a..fda9d0207d5935e029991083d892078f26c1e0f8 100644 (file)
@@ -1276,8 +1276,21 @@ wxString wxTextCtrl::GetLineText(long lineNo) const
         wxChar *buf = tmp;
 
         *(WORD *)buf = (WORD)len;
-        len = (size_t)::SendMessage(GetHwnd(), EM_GETLINE,
-                                    lineNo, (LPARAM)buf);
+        len = (size_t)::SendMessage(GetHwnd(), EM_GETLINE, lineNo, (LPARAM)buf);
+
+#if wxUSE_RICHEDIT
+        if ( IsRich() )
+        {
+            // remove the '\r' returned by the rich edit control, the user code
+            // should never see it
+            if ( buf[len - 2] == _T('\r') && buf[len - 1] == _T('\n') )
+            {
+                buf[len - 2] = _T('\n');
+                len--;
+            }
+        }
+#endif // wxUSE_RICHEDIT
+
         buf[len] = 0;
         tmp.SetLength(len);
     }