git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23333 
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
         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);
     }