riched20: Don't return DLGC_HASSETSEL from WM_GETDLGCODE if the control style includes ES_SAVESEL.

Hans Leidekker hans at codeweavers.com
Fri Mar 28 11:41:52 CDT 2014


---
 dlls/riched20/editor.c       |  5 ++++-
 dlls/riched20/tests/editor.c | 10 ++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index d38d28e..1d17ef0 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -3142,11 +3142,14 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
    return ME_StreamOut(editor, wParam, (EDITSTREAM *)lParam);
   case WM_GETDLGCODE:
   {
-    UINT code = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL;
+    UINT code = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS;
+
     if (lParam)
       editor->bDialogMode = TRUE;
     if (editor->styleFlags & ES_MULTILINE)
       code |= DLGC_WANTMESSAGE;
+    if (!(editor->styleFlags & ES_SAVESEL))
+      code |= DLGC_HASSETSEL;
     return code;
   }
   case EM_EMPTYUNDOBUFFER:
diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c
index 2efee9a..309de7a 100644
--- a/dlls/riched20/tests/editor.c
+++ b/dlls/riched20/tests/editor.c
@@ -6729,6 +6729,16 @@ static void test_WM_GETDLGCODE(void)
     ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n",
        res, expected);
     DestroyWindow(hwnd);
+
+    hwnd = CreateWindowExA(0, RICHEDIT_CLASS20A, NULL,
+                          WS_POPUP|ES_SAVESEL,
+                          0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+    ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS20A, (int) GetLastError());
+    res = SendMessageA(hwnd, WM_GETDLGCODE, 0, 0);
+    expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS;
+    ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n",
+       res, expected);
+    DestroyWindow(hwnd);
 }
 
 static void test_zoom(void)
-- 
1.9.1





More information about the wine-patches mailing list