riched20: Don't append '\r' to the last paragraph in EM_GETTEXTEX.

This commit is contained in:
Michael Jung 2006-04-23 21:09:30 +02:00 committed by Alexandre Julliard
parent 5c23aa19dc
commit 0dec18a3d6
2 changed files with 18 additions and 16 deletions

View File

@ -1956,7 +1956,7 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
DWORD flags = 0;
buflen = ME_GetTextW(editor, buffer, nStart, nCount, ex->flags & GT_USECRLF);
rc = WideCharToMultiByte(ex->codepage, flags, buffer, buflen, (LPSTR)lParam, ex->cb, ex->lpDefaultChar, ex->lpUsedDefaultChar);
rc = WideCharToMultiByte(ex->codepage, flags, buffer, -1, (LPSTR)lParam, ex->cb, ex->lpDefaultChar, ex->lpUsedDefaultChar);
HeapFree(GetProcessHeap(),0,buffer);
return rc;
@ -2499,21 +2499,26 @@ int ME_GetTextW(ME_TextEditor *editor, WCHAR *buffer, int nStart, int nChars, in
int nLen = ME_StrLen(item->member.run.strText);
if (nLen > nChars)
nLen = nChars;
if (item->member.run.nFlags & MERF_ENDPARA)
{
*buffer = '\r';
if (bCRLF)
{
*(++buffer) = '\n';
nWritten++;
if (!ME_FindItemFwd(item, diRun))
/* No '\r' is appended to the last paragraph. */
nLen = 0;
else {
*buffer = '\r';
if (bCRLF)
{
*(++buffer) = '\n';
nWritten++;
}
assert(nLen == 1);
/* our end paragraph consists of 2 characters now */
if (editor->bEmulateVersion10)
nChars--;
}
assert(nLen == 1);
/* our end paragraph consists of 2 characters now */
if (editor->bEmulateVersion10)
nChars--;
}
else
else
CopyMemory(buffer, item->member.run.strText->szData, sizeof(WCHAR)*nLen);
nChars -= nLen;
nWritten += nLen;

View File

@ -494,7 +494,6 @@ static void test_TM_PLAINTEXT()
DestroyWindow(hwndRichEdit);
}
/* FIXME: Extra '\r' appended at end of gotten text*/
static void test_WM_GETTEXT()
{
HWND hwndRichEdit = new_richedit(NULL);
@ -505,10 +504,8 @@ static void test_WM_GETTEXT()
SendMessage(hwndRichEdit, WM_SETTEXT, 0, (LPARAM) text);
SendMessage(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM) buffer);
result = strcmp(buffer,text);
todo_wine{
ok(result == 0,
ok(result == 0,
"WM_GETTEXT: settext and gettext differ. strcmp: %d\n", result);
}
}
/* FIXME: need to test unimplemented options and robustly test wparam */