Signed-off-by: Rafał Harabień <rafalh1992(a)o2.pl>
---
dlls/riched20/caret.c | 4 ++++
dlls/riched20/tests/editor.c | 14 ++++++++++++++
2 files changed, 18 insertions(+)
diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c
index 26af743..8a99394 100644
--- a/dlls/riched20/caret.c
+++ b/dlls/riched20/caret.c
@@ -551,6 +551,10 @@ void ME_InsertTextFromCursor(ME_TextEditor *editor, int nCursor,
ME_DisplayItem *tp, *end_run, *run, *prev;
int eol_len = 0;
+ /* Check if new line is allowed for this control */
+ if (!(editor->styleFlags & ES_MULTILINE))
+ break;
+
/* Find number of CR and LF in end of paragraph run */
if (*pos =='\r')
{
diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c
index a19ec85..d5fd8c0 100644
--- a/dlls/riched20/tests/editor.c
+++ b/dlls/riched20/tests/editor.c
@@ -70,6 +70,10 @@ static HWND new_richedit(HWND parent) {
return new_window(RICHEDIT_CLASS20A, ES_MULTILINE, parent);
}
+static HWND new_richedit_with_style(HWND parent, DWORD style) {
+ return new_window(RICHEDIT_CLASS20A, style, parent);
+}
+
static HWND new_richeditW(HWND parent) {
return new_windowW(RICHEDIT_CLASS20W, ES_MULTILINE, parent);
}
@@ -5509,10 +5513,20 @@ static void test_WM_PASTE(void)
/* Cut from read-only control */
SendMessageA(hwndRichEdit, EM_SETSEL, 0, -1);
SendMessageA(hwndRichEdit, WM_CUT, 0, 0);
+ SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buffer);
result = strcmp(buffer,"cut\r\n");
ok(result == 0,
"test paste: strcmp = %i, actual = '%s'\n", result, buffer);
+ OleFlushClipboard(); /* flush is needed because of broken OleClipboard implementation */
+ DestroyWindow(hwndRichEdit);
+ /* Paste multi-line text into single-line control */
+ hwndRichEdit = new_richedit_with_style(NULL, 0);
+ SendMessageA(hwndRichEdit, WM_PASTE, 0, 0);
+ SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buffer);
+ result = strcmp(buffer,"cut");
+ ok(result == 0,
+ "test paste: strcmp = %i, actual = '%s'\n", result, buffer);
DestroyWindow(hwndRichEdit);
}
--
2.7.4