Fix pasting multiline text in wxOSX to not use \r
Use wxMacConvertNewlines13To10(), not wxMacConvertNewlines10To13() when copying content from native pasteboard. Perform this conversion not only for 8bit text, but for UTF-16 one (which is the one actually used on modern OS X versions) as well.
This commit is contained in:
parent
eecf084d4d
commit
587067bc68
@ -30,6 +30,7 @@ WXDLLIMPEXP_BASE void wxMacConvertNewlines13To10( wxString *data ) ;
|
||||
WXDLLIMPEXP_BASE void wxMacConvertNewlines10To13( wxString *data ) ;
|
||||
|
||||
WXDLLIMPEXP_BASE void wxMacConvertNewlines13To10( char * data ) ;
|
||||
WXDLLIMPEXP_BASE void wxMacConvertNewlines13To10( char * data, size_t len ) ;
|
||||
WXDLLIMPEXP_BASE void wxMacConvertNewlines10To13( char * data ) ;
|
||||
|
||||
WXDLLIMPEXP_BASE wxUint32 wxMacGetSystemEncFromFontEnc(wxFontEncoding encoding) ;
|
||||
|
@ -487,8 +487,10 @@ bool wxDataObject::GetFromPasteboard( void * pb )
|
||||
memset( buf, 0, flavorDataSize + 4 );
|
||||
memcpy( buf, CFDataGetBytePtr( flavorData ), flavorDataSize );
|
||||
|
||||
if (dataFormat.GetType() == wxDF_TEXT)
|
||||
wxMacConvertNewlines10To13( (char*) buf );
|
||||
if (dataFormat.GetType() == wxDF_TEXT || dataFormat.GetType() == wxDF_UNICODETEXT)
|
||||
{
|
||||
wxMacConvertNewlines13To10( (char*) buf, flavorDataSize );
|
||||
}
|
||||
SetData( flavorFormat, flavorDataSize, buf );
|
||||
transferred = true;
|
||||
free( buf );
|
||||
|
@ -34,6 +34,15 @@ void wxMacConvertNewlines13To10( char * data )
|
||||
}
|
||||
}
|
||||
|
||||
void wxMacConvertNewlines13To10( char * data, size_t len )
|
||||
{
|
||||
for ( ; len; ++data, --len )
|
||||
{
|
||||
if ( *data == 0x0d )
|
||||
*data = 0x0a;
|
||||
}
|
||||
}
|
||||
|
||||
void wxMacConvertNewlines10To13( char * data )
|
||||
{
|
||||
char * buf = data ;
|
||||
|
Loading…
Reference in New Issue
Block a user