[PATCH v2 4/5] riched20: Return text without OLE object mark from WM_GETTEXT.
Jactry Zeng
jzeng at codeweavers.com
Tue May 25 02:06:02 CDT 2021
Signed-off-by: Jactry Zeng <jzeng at codeweavers.com>
---
dlls/riched20/editor.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 960d1401082..9d24d97d820 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -2076,10 +2076,11 @@ ME_FindText(ME_TextEditor *editor, DWORD flags, const CHARRANGE *chrg, const WCH
return -1;
}
-static int ME_GetTextEx(ME_TextEditor *editor, GETTEXTEX *ex, LPARAM pText)
+static int ME_GetTextEx(ME_TextEditor *editor, GETTEXTEX *ex, LPARAM pText, BOOL oleobj)
{
int nChars;
ME_Cursor start;
+ DWORD flags;
if (!ex->cb || !pText) return 0;
@@ -2098,10 +2099,14 @@ static int ME_GetTextEx(ME_TextEditor *editor, GETTEXTEX *ex, LPARAM pText)
ME_SetCursorToStart(editor, &start);
nChars = INT_MAX;
}
+
+ flags = (ex->flags & GT_USECRLF) ? MEGT_USECRLF : MEGT_DEFAULT;
+ if (!oleobj) flags |= MEGT_NOOLEOBJ;
+
if (ex->codepage == CP_UNICODE)
{
return ME_GetTextW(editor, (LPWSTR)pText, ex->cb / sizeof(WCHAR) - 1,
- &start, nChars, (ex->flags & GT_USECRLF) ? MEGT_USECRLF : MEGT_DEFAULT);
+ &start, nChars, flags);
}
else
{
@@ -2118,7 +2123,7 @@ static int ME_GetTextEx(ME_TextEditor *editor, GETTEXTEX *ex, LPARAM pText)
buflen = min(crlfmul * nChars, ex->cb - 1);
buffer = heap_alloc((buflen + 1) * sizeof(WCHAR));
- nChars = ME_GetTextW(editor, buffer, buflen, &start, nChars, (ex->flags & GT_USECRLF) ? MEGT_USECRLF : MEGT_DEFAULT);
+ nChars = ME_GetTextW(editor, buffer, buflen, &start, nChars, flags);
rc = WideCharToMultiByte(ex->codepage, 0, buffer, nChars + 1,
(LPSTR)pText, ex->cb, ex->lpDefaultChar, ex->lpUsedDefChar);
if (rc) rc--; /* do not count 0 terminator */
@@ -3662,10 +3667,10 @@ LRESULT editor_handle_message( ME_TextEditor *editor, UINT msg, WPARAM wParam,
ex.codepage = CP_UNICODE;
ex.lpDefaultChar = NULL;
ex.lpUsedDefChar = NULL;
- return ME_GetTextEx(editor, &ex, lParam);
+ return ME_GetTextEx(editor, &ex, lParam, FALSE);
}
case EM_GETTEXTEX:
- return ME_GetTextEx(editor, (GETTEXTEX*)wParam, lParam);
+ return ME_GetTextEx(editor, (GETTEXTEX*)wParam, lParam, TRUE);
case EM_GETSELTEXT:
{
int nFrom, nTo, nStartCur = ME_GetSelectionOfs(editor, &nFrom, &nTo);
--
2.30.2
More information about the wine-devel
mailing list