Module: wine Branch: master Commit: ac5edd1b6bc6da1a9333be75169863cd36ea4522 URL: http://source.winehq.org/git/wine.git/?a=commit;h=ac5edd1b6bc6da1a9333be7516...
Author: Huw Davies huw@codeweavers.com Date: Thu Mar 10 11:59:41 2016 +0000
riched20: \pard resets the reading direction.
Signed-off-by: Huw Davies huw@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/riched20/editor.c | 3 ++- dlls/riched20/tests/editor.c | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index 7b87dfc..7ac94ca 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -553,7 +553,7 @@ void ME_RTFParAttrHook(RTF_Info *info) info->borderType = RTFBorderParaTop; info->fmt.dwMask = PFM_ALIGNMENT | PFM_BORDER | PFM_LINESPACING | PFM_TABSTOPS | PFM_OFFSET | PFM_RIGHTINDENT | PFM_SPACEAFTER | PFM_SPACEBEFORE | - PFM_STARTINDENT; + PFM_STARTINDENT | PFM_RTLPARA; /* TODO: numbering, shading */ info->fmt.wAlignment = PFA_LEFT; info->fmt.cTabCount = 0; @@ -563,6 +563,7 @@ void ME_RTFParAttrHook(RTF_Info *info) info->fmt.bLineSpacingRule = 0; info->fmt.dySpaceBefore = info->fmt.dySpaceAfter = 0; info->fmt.dyLineSpacing = 0; + info->fmt.wEffects &= ~PFE_RTLPARA; if (!info->editor->bEmulateVersion10) /* v4.1 */ { if (info->tableDef && info->tableDef->tableRowStart && diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c index 18d080c..c6444ff 100644 --- a/dlls/riched20/tests/editor.c +++ b/dlls/riched20/tests/editor.c @@ -8284,10 +8284,12 @@ static void test_rtf_specials(void) "\rquote\ldblquote\rdblquote\ltrmark\rtlmark\zwj\zwnj}"; const WCHAR expect_specials[] = {' ',' ',0x2022,0x2018,0x2019,0x201c, 0x201d,0x200e,0x200f,0x200d,0x200c}; + const char *pard = "{\rtf1 ABC\rtlpar\par DEF\par HIJ\pard\par}"; HWND edit = new_richeditW( NULL ); EDITSTREAM es; WCHAR buf[80]; LRESULT result; + PARAFORMAT2 fmt;
es.dwCookie = (DWORD_PTR)&specials; es.dwError = 0; @@ -8299,6 +8301,26 @@ static void test_rtf_specials(void) 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) );
+ /* Show that \rtlpar propagates to the second paragraph and is + reset by \pard in the third. */ + es.dwCookie = (DWORD_PTR)&pard; + result = SendMessageA( edit, EM_STREAMIN, SF_RTF, (LPARAM)&es ); + ok( result == 11, "got %ld\n", result ); + + fmt.cbSize = sizeof(fmt); + SendMessageW( edit, EM_SETSEL, 1, 1 ); + SendMessageW( edit, EM_GETPARAFORMAT, 0, (LPARAM)&fmt ); + ok( fmt.dwMask & PFM_RTLPARA, "rtl para mask not set\n" ); + ok( fmt.wEffects & PFE_RTLPARA, "rtl para not set\n" ); + SendMessageW( edit, EM_SETSEL, 5, 5 ); + SendMessageW( edit, EM_GETPARAFORMAT, 0, (LPARAM)&fmt ); + ok( fmt.dwMask & PFM_RTLPARA, "rtl para mask not set\n" ); + ok( fmt.wEffects & PFE_RTLPARA, "rtl para not set\n" ); + SendMessageW( edit, EM_SETSEL, 9, 9 ); + SendMessageW( edit, EM_GETPARAFORMAT, 0, (LPARAM)&fmt ); + ok( fmt.dwMask & PFM_RTLPARA, "rtl para mask not set\n" ); + ok( !(fmt.wEffects & PFE_RTLPARA), "rtl para set\n" ); + DestroyWindow( edit ); }