Commit b70eb32c authored by Jinoh Kang's avatar Jinoh Kang Committed by Alexandre Julliard

riched20: Wrap marked paragraphs at Text Services initialization.

Today, CreateTextServices() returns an Rich Edit object without row start and end marks, which are expected to exist by many Rich Edit operations as well as EM_* message handlers. This leads to a crash when certain messages (e.g., EM_SCROLLCARET) are sent to the Rich Edit object via ITextServices::TxSendMessage(), unless ME_WrapMarkedParagraphs() has been called beforehand. Fix this by calling wrap_marked_paras_dc() early in the initialization process. This is not a problem for windowed Rich Edit controls, which already calls ME_WrapMarkedParagraphs() before the user or application starts interacting with it.
parent f1b91504
......@@ -222,6 +222,7 @@ void ME_MakeFirstParagraph(ME_TextEditor *editor)
wine_rb_init( &editor->marked_paras, para_mark_compare );
para_mark_add( editor, para );
ME_DestroyContext(&c);
wrap_marked_paras_dc( editor, hdc, FALSE );
ITextHost_TxReleaseDC( editor->texthost, hdc );
}
......
......@@ -1292,6 +1292,23 @@ static void test_set_selection_message( void )
ITextHost_Release( host );
}
static void test_scrollcaret( void )
{
ITextServices *txtserv;
ITextHost *host;
LRESULT result;
HRESULT hr;
if (!init_texthost(&txtserv, &host))
return;
hr = ITextServices_TxSendMessage(txtserv, EM_SCROLLCARET, 0, 0, &result);
ok( hr == S_OK, "got %08lx\n", hr );
ITextServices_Release( txtserv );
ITextHost_Release( host );
}
START_TEST( txtsrv )
{
ITextServices *txtserv;
......@@ -1326,6 +1343,7 @@ START_TEST( txtsrv )
test_TxGetScroll();
test_notifications();
test_set_selection_message();
test_scrollcaret();
}
if (wrapperCodeMem) VirtualFree(wrapperCodeMem, 0, MEM_RELEASE);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment