Krzysztof Foltman : riched20: Make EM_GETLINE work properly in 1.
0 emulation mode.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Aug 3 15:58:34 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: 9667a891ffb769f2f0bdc0f7362122fe97d2025d
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=9667a891ffb769f2f0bdc0f7362122fe97d2025d
Author: Krzysztof Foltman <wdev at foltman.com>
Date: Thu Aug 3 20:35:01 2006 +0200
riched20: Make EM_GETLINE work properly in 1.0 emulation mode.
---
dlls/riched20/editor.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 99422e2..c636023 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -2048,6 +2048,9 @@ LRESULT WINAPI RichEditANSIWndProc(HWND
const unsigned int nMaxChars = *(WORD *) lParam;
unsigned int nEndChars, nCharsLeft = nMaxChars;
char *dest = (char *) lParam;
+ /* rich text editor 1.0 uses \r\n for line end, 2.0 uses just \r;
+ we need to know how if we have the extra \n or not */
+ int nLF = editor->bEmulateVersion10;
TRACE("EM_GETLINE: row=%d, nMaxChars=%d (%s)\n", (int) wParam, nMaxChars,
bUnicode ? "Unicode" : "Ansi");
@@ -2075,20 +2078,21 @@ LRESULT WINAPI RichEditANSIWndProc(HWND
nCharsLeft -= nCopy;
}
- /* append \r\0, space allowing */
- nEndChars = min(nCharsLeft, 2);
+ /* append \r\0 (or \r\n\0 in 1.0), space allowing */
+ nEndChars = min(nCharsLeft, 2 + nLF);
nCharsLeft -= nEndChars;
if (bUnicode)
{
const WCHAR src[] = {'\r', '\0'};
- lstrcpynW((LPWSTR) dest, src, nEndChars);
+ const WCHAR src10[] = {'\r', '\n', '\0'};
+ lstrcpynW((LPWSTR) dest, nLF ? src10 : src, nEndChars);
}
else
- lstrcpynA(dest, "\r", nEndChars);
+ lstrcpynA(dest, nLF ? "\r\n" : "\r", nEndChars);
TRACE("EM_GETLINE: got %u bytes\n", nMaxChars - nCharsLeft);
- if (nEndChars == 2)
+ if (nEndChars == 2 + nLF)
return nMaxChars - nCharsLeft - 1; /* don't count \0 */
else
return nMaxChars - nCharsLeft;
More information about the wine-cvs
mailing list