The function of Paste() works improperly, especially for non-ascii characters.
The details about this problem are described at http://forums.codeblocks.org/index.php/topic,1929.msg43896.html#msg43896
Here are two patches: one is basic, and the other is optimized.
*** src/ScintillaWX.cpp Wed Jan 31 15:13:24 2007
--- src/ScintillaWX-new.cpp Fri May 11 13:15:38 2007
***************
*** 508,514 ****
if (gotRectData && selData.GetSize()>1) {
const char* rectBuf = (const char*)selData.GetData();
rectangular = rectBuf[0] == (char)1;
! len = selData.GetDataSize()-1;
char* buffer = new char[len];
memcpy (buffer, rectBuf+1, len);
textString = sci2wx(buffer, len);
--- 508,514 ----
if (gotRectData && selData.GetSize()>1) {
const char* rectBuf = (const char*)selData.GetData();
rectangular = rectBuf[0] == (char)1;
! len = selData.GetDataSize()-2; // The first and last char should be stripped!
char* buffer = new char[len];
memcpy (buffer, rectBuf+1, len);
textString = sci2wx(buffer, len);
====================
*** src/ScintillaWX.cpp Wed Jan 31 15:13:24 2007
--- src/ScintillaWX-new.cpp Fri May 11 13:29:42 2007
***************
*** 494,500 ****
#if wxUSE_DATAOBJ
wxTextDataObject data;
! wxString textString;
wxWX2MBbuf buf;
int len = 0;
--- 494,500 ----
#if wxUSE_DATAOBJ
wxTextDataObject data;
! wxString textString = wxEmptyString;
wxWX2MBbuf buf;
int len = 0;
***************
*** 508,531 ****
if (gotRectData && selData.GetSize()>1) {
const char* rectBuf = (const char*)selData.GetData();
rectangular = rectBuf[0] == (char)1;
! len = selData.GetDataSize()-1;
! char* buffer = new char[len];
! memcpy (buffer, rectBuf+1, len);
! textString = sci2wx(buffer, len);
! delete buffer;
} else {
bool gotData = wxTheClipboard->GetData(data);
if (gotData) {
textString = wxTextBuffer::Translate (data.GetText(),
wxConvertEOLMode(pdoc->eolMode));
}
}
data.SetText(wxEmptyString); // free the data object content
wxTheClipboard->Close();
}
- buf = (wxWX2MBbuf)wx2sci(textString);
- len = strlen(buf);
int newPos = 0;
if (rectangular) {
int newLine = pdoc->LineFromPosition (currentPos) + wxCountLines (buf, pdoc->eolMode);
--- 508,528 ----
if (gotRectData && selData.GetSize()>1) {
const char* rectBuf = (const char*)selData.GetData();
rectangular = rectBuf[0] == (char)1;
! len = selData.GetDataSize()-2; // The first and last char should be stripped!
! buf=rectBuf+1;
} else {
bool gotData = wxTheClipboard->GetData(data);
if (gotData) {
textString = wxTextBuffer::Translate (data.GetText(),
wxConvertEOLMode(pdoc->eolMode));
+ buf = (wxWX2MBbuf)wx2sci(textString);
+ len = strlen(buf);
}
}
data.SetText(wxEmptyString); // free the data object content
wxTheClipboard->Close();
}
int newPos = 0;
if (rectangular) {
int newLine = pdoc->LineFromPosition (currentPos) + wxCountLines (buf, pdoc->eolMode);
====================
Logged In: YES
user_id=1190746
Originator: YES
File Added: ScintillaWX.cpp-optimized.patch
Optimized fixes
Basic fixes
Logged In: YES
user_id=1190746
Originator: YES
File Added: ScintillaWX.cpp-basic.patch
Logged In: YES
user_id=1190746
Originator: YES
Sorry, I am not sure the optimized fixes would works always.