mirror of https://github.com/fltk/fltk
STR 1200: fixed wrong allocation of copy/paste buffer
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4891 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
a33f1f7b35
commit
23655ba4d5
|
@ -2159,14 +2159,15 @@ void Fl::paste(Fl_Widget &receiver, int clipboard) {
|
|||
Size len = 0;
|
||||
if (GetCurrentScrap(&scrap) == noErr && scrap != myScrap &&
|
||||
GetScrapFlavorSize(scrap, kScrapFlavorTypeText, &len) == noErr) {
|
||||
if ( len > fl_selection_buffer_length[1] ) {
|
||||
if ( len >= fl_selection_buffer_length[1] ) {
|
||||
fl_selection_buffer_length[1] = len + 32;
|
||||
delete[] fl_selection_buffer[1];
|
||||
fl_selection_buffer[1] = new char[len];
|
||||
fl_selection_buffer[1] = new char[len + 32];
|
||||
}
|
||||
fl_selection_length[1] = len; len++;
|
||||
GetScrapFlavorData( scrap, kScrapFlavorTypeText, &len,
|
||||
fl_selection_buffer[1] );
|
||||
fl_selection_length[1] = len;
|
||||
fl_selection_buffer[1][fl_selection_length[1]] = 0;
|
||||
// turn all \r characters into \n:
|
||||
for (int x = 0; x < len; x++) {
|
||||
if (fl_selection_buffer[1][x] == '\r')
|
||||
|
|
Loading…
Reference in New Issue