richedit: Use RTF reader for text starting with {\urtf.
This commit is contained in:
parent
44be6c7cbf
commit
bdf181b4d3
|
@ -2741,8 +2741,9 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam,
|
|||
ME_GetSelection(editor, &from, &to);
|
||||
style = ME_GetSelectionInsertStyle(editor);
|
||||
ME_InternalDeleteText(editor, from, to - from, FALSE);
|
||||
if (pStruct->codepage != 1200 && lParam && !strncmp((char *)lParam, "{\\rtf", 5))
|
||||
ME_StreamInRTFString(editor, 1, (char *)lParam);
|
||||
if (pStruct->codepage != 1200 && lParam &&
|
||||
(!strncmp((char *)lParam, "{\\rtf", 5) || !strncmp((char *)lParam, "{\\urtf}", 6)))
|
||||
ME_StreamInRTFString(editor, 1, (char *)lParam);
|
||||
else ME_InsertTextFromCursor(editor, 0, wszText, len, style);
|
||||
ME_ReleaseStyle(style);
|
||||
|
||||
|
@ -2750,8 +2751,9 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam,
|
|||
}
|
||||
else {
|
||||
ME_InternalDeleteText(editor, 0, ME_GetTextLength(editor), FALSE);
|
||||
if (pStruct->codepage != 1200 && lParam && !strncmp((char *)lParam, "{\\rtf", 5))
|
||||
ME_StreamInRTFString(editor, 0, (char *)lParam);
|
||||
if (pStruct->codepage != 1200 && lParam &&
|
||||
(!strncmp((char *)lParam, "{\\rtf", 5) || !strncmp((char *)lParam, "{\\urtf}", 6)))
|
||||
ME_StreamInRTFString(editor, 0, (char *)lParam);
|
||||
else ME_InsertTextFromCursor(editor, 0, wszText, len, editor->pBuffer->pDefaultStyle);
|
||||
len = 1;
|
||||
|
||||
|
|
|
@ -3522,6 +3522,28 @@ static void test_EM_SETTEXTEX(void)
|
|||
"EM_GETTEXTEX results not what was set by EM_SETTEXTEX when"
|
||||
" using ST_SELECTION and non-Unicode\n");
|
||||
|
||||
/* Test setting text using rich text format */
|
||||
setText.flags = 0;
|
||||
setText.codepage = CP_ACP;
|
||||
SendMessage(hwndRichEdit, EM_SETTEXTEX, (WPARAM)&setText, (LPARAM)"{\\rtf richtext}");
|
||||
getText.codepage = CP_ACP;
|
||||
getText.cb = MAX_BUF_LEN;
|
||||
getText.flags = GT_DEFAULT;
|
||||
getText.lpDefaultChar = NULL;
|
||||
getText.lpUsedDefChar = NULL;
|
||||
SendMessage(hwndRichEdit, EM_GETTEXTEX, (WPARAM)&getText, (LPARAM) bufACP);
|
||||
ok(!strcmp(bufACP, "richtext"), "expected 'richtext' but got '%s'\n", bufACP);
|
||||
|
||||
setText.flags = 0;
|
||||
setText.codepage = CP_ACP;
|
||||
SendMessage(hwndRichEdit, EM_SETTEXTEX, (WPARAM)&setText, (LPARAM)"{\\urtf morerichtext}");
|
||||
getText.codepage = CP_ACP;
|
||||
getText.cb = MAX_BUF_LEN;
|
||||
getText.flags = GT_DEFAULT;
|
||||
getText.lpDefaultChar = NULL;
|
||||
getText.lpUsedDefChar = NULL;
|
||||
SendMessage(hwndRichEdit, EM_GETTEXTEX, (WPARAM)&getText, (LPARAM) bufACP);
|
||||
ok(!strcmp(bufACP, "morerichtext"), "expected 'morerichtext' but got '%s'\n", bufACP);
|
||||
|
||||
DestroyWindow(hwndRichEdit);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue