Lei Zhang : riched20:
Do not pass NULL lParam to ME_ToUnicode for EM_REPLACESEL.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Sep 11 07:28:41 CDT 2007
Module: wine
Branch: master
Commit: 9210defdf77e6db5830fdb1206fb077df60ce00f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9210defdf77e6db5830fdb1206fb077df60ce00f
Author: Lei Zhang <thestig at google.com>
Date: Thu Sep 6 15:42:49 2007 -0700
riched20: Do not pass NULL lParam to ME_ToUnicode for EM_REPLACESEL.
---
dlls/riched20/editor.c | 4 ++--
dlls/riched20/tests/editor.c | 22 ++++++++++++++++++++++
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index f46c4b2..3e1cdf2 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -1822,8 +1822,8 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam,
{
int from, to;
ME_Style *style;
- LPWSTR wszText = ME_ToUnicode(unicode, (void *)lParam);
- size_t len = lstrlenW(wszText);
+ LPWSTR wszText = lParam ? ME_ToUnicode(unicode, (void *)lParam) : NULL;
+ size_t len = wszText ? lstrlenW(wszText) : 0;
TRACE("EM_REPLACESEL - %s\n", debugstr_w(wszText));
ME_GetSelection(editor, &from, &to);
diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c
index 1f1e809..a1407b7 100644
--- a/dlls/riched20/tests/editor.c
+++ b/dlls/riched20/tests/editor.c
@@ -1456,6 +1456,27 @@ static void test_EM_EXSETSEL(void)
DestroyWindow(hwndRichEdit);
}
+static void test_EM_REPLACESEL(void)
+{
+ HWND hwndRichEdit = new_richedit(NULL);
+ char buffer[1024] = {0};
+ int r;
+
+ /* sending some text to the window */
+ SendMessage(hwndRichEdit, WM_SETTEXT, 0, (LPARAM) "testing selection");
+ /* 01234567890123456*/
+ /* 10 */
+
+ /* FIXME add more tests */
+ SendMessage(hwndRichEdit, EM_SETSEL, 7, 17);
+ SendMessage(hwndRichEdit, EM_REPLACESEL, 0, (LPARAM) NULL);
+ SendMessage(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM) buffer);
+ r = strcmp(buffer, "testing");
+ ok(0 == r, "expected %d, got %d\n", 0, r);
+
+ DestroyWindow(hwndRichEdit);
+}
+
static void test_WM_PASTE(void)
{
int result;
@@ -1922,6 +1943,7 @@ START_TEST( editor )
test_EM_FORMATRANGE();
test_unicode_conversions();
test_EM_GETTEXTLENGTHEX();
+ test_EM_REPLACESEL();
/* Set the environment variable WINETEST_RICHED20 to keep windows
* responsive and open for 30 seconds. This is useful for debugging.
More information about the wine-cvs
mailing list