From da7c4f97532de8cd16fedbe918bbee272022bbb8 Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Mon, 29 Feb 2016 12:06:26 +0000 Subject: [PATCH] riched20: Add handling for a few more special characters. Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard --- dlls/riched20/reader.c | 18 ++++++++++++++++++ dlls/riched20/tests/editor.c | 26 ++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/dlls/riched20/reader.c b/dlls/riched20/reader.c index 27d0182b09d..2e5dafd5034 100644 --- a/dlls/riched20/reader.c +++ b/dlls/riched20/reader.c @@ -2544,6 +2544,12 @@ static void SpecialChar (RTF_Info *info) case rtfEnDash: RTFPutUnicodeChar (info, 0x2013); break; + case rtfEmSpace: + RTFPutUnicodeChar (info, ' '); + break; + case rtfEnSpace: + RTFPutUnicodeChar (info, ' '); + break; case rtfLQuote: RTFPutUnicodeChar (info, 0x2018); break; @@ -2556,6 +2562,18 @@ static void SpecialChar (RTF_Info *info) case rtfRDblQuote: RTFPutUnicodeChar (info, 0x201D); break; + case rtfLTRMark: + RTFPutUnicodeChar (info, 0x200E); + break; + case rtfRTLMark: + RTFPutUnicodeChar (info, 0x200F); + break; + case rtfNoWidthJoiner: + RTFPutUnicodeChar (info, 0x200D); + break; + case rtfNoWidthNonJoiner: + RTFPutUnicodeChar (info, 0x200C); + break; } } diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c index 98b31cef9b4..18d080c1930 100644 --- a/dlls/riched20/tests/editor.c +++ b/dlls/riched20/tests/editor.c @@ -8278,6 +8278,31 @@ static void test_WM_GETTEXTLENGTH(void) DestroyWindow(hwndRichEdit); } +static void test_rtf_specials(void) +{ + const char *specials = "{\\rtf1\\emspace\\enspace\\bullet\\lquote" + "\\rquote\\ldblquote\\rdblquote\\ltrmark\\rtlmark\\zwj\\zwnj}"; + const WCHAR expect_specials[] = {' ',' ',0x2022,0x2018,0x2019,0x201c, + 0x201d,0x200e,0x200f,0x200d,0x200c}; + HWND edit = new_richeditW( NULL ); + EDITSTREAM es; + WCHAR buf[80]; + LRESULT result; + + es.dwCookie = (DWORD_PTR)&specials; + es.dwError = 0; + es.pfnCallback = test_EM_STREAMIN_esCallback; + result = SendMessageA( edit, EM_STREAMIN, SF_RTF, (LPARAM)&es ); + ok( result == 11, "got %ld\n", result ); + + result = SendMessageW( edit, WM_GETTEXT, sizeof(buf)/sizeof(buf[0]), (LPARAM)buf ); + ok( result == sizeof(expect_specials)/sizeof(expect_specials[0]), "got %ld\n", result ); + ok( !memcmp( buf, expect_specials, sizeof(expect_specials) ), "got %s\n", wine_dbgstr_w(buf) ); + + DestroyWindow( edit ); +} + + START_TEST( editor ) { BOOL ret; @@ -8347,6 +8372,7 @@ START_TEST( editor ) test_EM_SETREADONLY(); test_EM_SETFONTSIZE(); test_alignment_style(); + test_rtf_specials(); /* Set the environment variable WINETEST_RICHED20 to keep windows * responsive and open for 30 seconds. This is useful for debugging.