[PATCH] riched32: On VK_RETURN don't add newline into text
Fabian Maurer
dark.shadow4 at web.de
Sun Dec 9 15:00:46 CST 2018
This fixes an old regression when VK_RETURN handling was implemented
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=23282
Signed-off-by: Fabian Maurer <dark.shadow4 at web.de>
---
dlls/riched20/editor.c | 2 --
dlls/riched20/tests/editor.c | 19 +++++++++++++++++++
dlls/riched32/tests/editor.c | 19 +++++++++++++++++++
3 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 99c87bf61d..a9956d5d2f 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -2637,8 +2637,6 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey)
else
if (!editor->bEmulateVersion10)
ME_InsertTextFromCursor(editor, 0, &endl, 1, eop_style);
- else
- ME_InsertTextFromCursor(editor, 0, endlv10, 2, eop_style);
ME_CommitCoalescingUndo(editor);
SetCursor(NULL);
diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c
index 035869e134..b3e8c75fa4 100644
--- a/dlls/riched20/tests/editor.c
+++ b/dlls/riched20/tests/editor.c
@@ -8920,6 +8920,24 @@ static void test_EM_SELECTIONTYPE(void)
DestroyWindow(hwnd);
}
+static void test_VK_RETURN(void)
+{
+ HWND hwnd_richedit = new_richedit(NULL);
+ char buffer[100];
+ GETTEXTEX gettex = {sizeof(buffer)};
+ int len;
+
+ SendMessageW(hwnd_richedit, WM_CHAR, 'T', 0);
+ SendMessageW(hwnd_richedit, WM_KEYDOWN, VK_RETURN, 0);
+ SendMessageW(hwnd_richedit, WM_CHAR, 'S', 0);
+ SendMessageW(hwnd_richedit, WM_KEYDOWN, VK_RETURN, 0);
+
+ len = SendMessageA(hwnd_richedit, EM_GETTEXTEX, &gettex, buffer);
+
+ ok(len == 4, "Got %d\n", len);
+ ok(strcmp(buffer, "T\rS\r") == 0, "Got %s\n", buffer);
+}
+
START_TEST( editor )
{
BOOL ret;
@@ -8995,6 +9013,7 @@ START_TEST( editor )
test_eop_char_fmt();
test_para_numbering();
test_EM_SELECTIONTYPE();
+ test_VK_RETURN();
/* Set the environment variable WINETEST_RICHED20 to keep windows
* responsive and open for 30 seconds. This is useful for debugging.
diff --git a/dlls/riched32/tests/editor.c b/dlls/riched32/tests/editor.c
index 7751d2b402..8cb28fa773 100644
--- a/dlls/riched32/tests/editor.c
+++ b/dlls/riched32/tests/editor.c
@@ -1412,6 +1412,24 @@ static void test_EM_SETSEL(void)
DestroyWindow(hwndRichEdit);
}
+static void test_VK_RETURN(void)
+{
+ HWND hwnd_richedit = new_richedit(NULL);
+ char buffer[100];
+ GETTEXTEX gettex = {sizeof(buffer)};
+ int len;
+
+ SendMessageW(hwnd_richedit, WM_CHAR, 'T', 0);
+ SendMessageW(hwnd_richedit, WM_KEYDOWN, VK_RETURN, 0);
+ SendMessageW(hwnd_richedit, WM_CHAR, 'S', 0);
+ SendMessageW(hwnd_richedit, WM_KEYDOWN, VK_RETURN, 0);
+
+ len = SendMessageA(hwnd_richedit, EM_GETTEXTEX, &gettex, buffer);
+
+ ok(len == 2, "Got %d\n", len);
+ ok(strcmp(buffer, "TS") == 0, "Got %s\n", buffer);
+}
+
START_TEST( editor )
{
MSG msg;
@@ -1440,6 +1458,7 @@ START_TEST( editor )
test_enter();
test_EM_EXSETSEL();
test_EM_SETSEL();
+ test_VK_RETURN();
/* Set the environment variable WINETEST_RICHED32 to keep windows
* responsive and open for 30 seconds. This is useful for debugging.
--
2.19.2
More information about the wine-devel
mailing list