Patches item #1716953, was opened at 2007-05-11 09:03 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=462818&aid=1716953&group_id=51305
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: CVS HEAD Status: Open Resolution: None Priority: 5 Private: No Submitted By: heromyth (heromyth) Assigned to: Nobody/Anonymous (nobody) Summary: [wxScintilla] Fixes for void ScintillaWX::Paste() Initial Comment: 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. The basic fixes are: ==================== *** 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); ==================== The optimized ones are: ==================== *** 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); ==================== ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=462818&aid=1716953&group_id=51305 ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ wxCode-users mailing list wxCode-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxcode-users