winemac: Convert old-Mac-style line breaks (CR) to Windows-style CRLF when importing UTF-16.
At least one Mac app, TextWrangler, puts UTF-16 data on the pasteboard with lines separated by CR (although it uses LF for the UTF-8 form of the same text). Other Mac apps handle it properly; we should, too. Signed-off-by: Ken Thomases <ken@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
861541c5e6
commit
e846da321a
|
@ -1176,6 +1176,8 @@ static HANDLE import_utf16_to_unicodetext(CFDataRef data)
|
|||
{
|
||||
if (src[i] == '\n')
|
||||
new_lines++;
|
||||
else if (src[i] == '\r' && (i + 1 >= src_len || src[i + 1] != '\n'))
|
||||
new_lines++;
|
||||
}
|
||||
|
||||
if ((unicode_handle = GlobalAlloc(GMEM_FIXED, (src_len + new_lines + 1) * sizeof(WCHAR))))
|
||||
|
@ -1188,6 +1190,9 @@ static HANDLE import_utf16_to_unicodetext(CFDataRef data)
|
|||
dst[j++] = '\r';
|
||||
|
||||
dst[j++] = src[i];
|
||||
|
||||
if (src[i] == '\r' && (i + 1 >= src_len || src[i + 1] != '\n'))
|
||||
dst[j++] = '\n';
|
||||
}
|
||||
dst[j] = 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue