[PATCH 2/2] riched20: Substitute object runs with U+FFFC if GT_RAWTEXT is given.

Huw Davies huw at codeweavers.com
Mon Mar 28 02:10:15 CDT 2022


On Mon, Mar 28, 2022 at 12:41:12AM +0900, Jinoh Kang wrote:
> Signed-off-by: Jinoh Kang <jinoh.kang.kr at gmail.com>
> ---
>  dlls/riched20/editor.c        | 6 ++++++
>  dlls/riched20/tests/richole.c | 4 ++--
>  2 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
> index 3d2d49af047..454a8bf5fc8 100644
> --- a/dlls/riched20/editor.c
> +++ b/dlls/riched20/editor.c
> @@ -4271,6 +4271,12 @@ int ME_GetTextW(ME_TextEditor *editor, WCHAR *buffer, int buflen,
>        nLen = 2;
>        str = L"\r\n";
>      }
> +    else if (flags & GT_RAWTEXT && run->nFlags & MERF_GRAPHICS)
> +    {
> +      srcChars -= min(nLen, srcChars);
> +      nLen = 1;
> +      str = L"\xfffc";
> +    }
>      else
>      {
>        nLen = min(nLen, srcChars);
> diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c
> index 24284a24484..dc0d7c4e1f1 100644
> --- a/dlls/riched20/tests/richole.c
> +++ b/dlls/riched20/tests/richole.c
> @@ -3404,7 +3404,7 @@ static void test_InsertObject(void)
>    memset(buffer, 0, sizeof(buffer));
>    result = SendMessageW(hwnd, EM_GETTEXTEX, (WPARAM)&gettextex, (LPARAM)buffer);
>    ok(result == lstrlenW(expected_string), "Got wrong length: %ld.\n", result);
> -  todo_wine ok(!lstrcmpW(buffer, expected_string), "Got wrong content: %s.\n", debugstr_w(buffer));
> +  ok(!lstrcmpW(buffer, expected_string), "Got wrong content: %s.\n", debugstr_w(buffer));

The tests just before this show that GT_DEFAULT behaves in the same
way (which conflicts with the docs).  Though it would be worth
hacking new_richedit() to create a MSFTEDIT_CLASS window to see if
that changes anything.

I think the right thing to do is to store 0xfffc in memory (see
editor_insert_oleobj()) and fixup the other text getters that need to
return a space (possibly introducing a custom GT_ flag so this can be
done in ME_GetTextW()).

Huw.



More information about the wine-devel mailing list