DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New] Link: http://www.fltk.org/str.php?L2121 Version: 1.3-current Hi, I have seen that pasting text from clipboard to Fl_Input widgets with cmd-V does not work with 1.3.x-r6618 on Mac OS 10.5. The problem is in function void Fl::paste(Fl_Widget &receiver, int clipboard) from file Fl_Mac.cxx which asks for public.utf8-plain-text pasteboard flavor whereas text is put as public.utf16-plain-text flavor in the clipboard by many applications (e.g., Word, TextWrangler). This also requires data from the clipboard to be converted from UTF16 to UTF8 before being transmitted to Fl_Input. Finally all \r's must also be changed to \n. The following code fragment that replaces lines 2571 and following of Fl_Mac.cxx repairs the bug. Pasting to Fl_Input works well with roman, greek, arabic, hebrew, russian, but not with chinese, probably for other reasons. if (UTTypeConformsTo(flavorType, CFSTR("public.utf16-plain-text"))) { err = PasteboardCopyItemFlavorData( myPasteboard, itemID, CFSTR("public.utf16-plain-text"), &flavorData ); if(err != noErr) continue; len = CFDataGetLength(flavorData); CFStringRef mycfs = CFStringCreateWithBytes(NULL, CFDataGetBytePtr(flavorData), len, kCFStringEncodingUnicode, false); CFRelease (flavorData); len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(mycfs), kCFStringEncodingUTF8) + 1; if ( len > fl_selection_buffer_length[1] ) { fl_selection_buffer_length[1] = len; delete[] fl_selection_buffer[1]; fl_selection_buffer[1] = new char[len]; } CFStringGetCString(mycfs, fl_selection_buffer[1], len, kCFStringEncodingUTF8); CFRelease (mycfs); len = strlen(fl_selection_buffer[1]); fl_selection_length[1] = len; for(char *p=fl_selection_buffer[1]; p < fl_selection_buffer[1]+len; p++) if(*p == '\r') *p = '\n'; i = nFlavor+1; break; } ======================================================== Link: http://www.fltk.org/str.php?L2121 Version: 1.3-current _______________________________________________ fltk-bugs mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk-bugs
