From c21f3211ea2d477a7468f9f27c59ef36fbdc6200 Mon Sep 17 00:00:00 2001
From: Julian Smart <julian@anthemion.co.uk>
Date: Sun, 30 Dec 2007 14:20:49 +0000
Subject: [PATCH] Fixed pasting inefficiency

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50947 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 src/richtext/richtextbuffer.cpp | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp
index 38de2d611a..4555750c05 100644
--- a/src/richtext/richtextbuffer.cpp
+++ b/src/richtext/richtextbuffer.cpp
@@ -5603,9 +5603,20 @@ bool wxRichTextBuffer::PasteFromClipboard(long position)
                 wxTextDataObject data;
                 wxTheClipboard->GetData(data);
                 wxString text(data.GetText());
-                text.Replace(_T("\r\n"), _T("\n"));
-
-                InsertTextWithUndo(position+1, text, GetRichTextCtrl());
+#ifdef __WXMSW__
+                wxString text2;
+                text2.Alloc(text.Length()+1);
+                size_t i;
+                for (i = 0; i < text.Length(); i++)
+                {
+                    wxChar ch = text[i];
+                    if (ch != wxT('\r'))
+                        text2 += ch;
+                }
+#else
+                wxString text2 = text;
+#endif
+                InsertTextWithUndo(position+1, text2, GetRichTextCtrl());
 
                 success = true;
             }
-- 
2.47.2