From: Paul Gofman <pgofman@codeweavers.com> --- dlls/imm32/ime.c | 5 ++++- dlls/imm32/tests/imm32.c | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/dlls/imm32/ime.c b/dlls/imm32/ime.c index 3cf7c1ed00a..253ce2c3610 100644 --- a/dlls/imm32/ime.c +++ b/dlls/imm32/ime.c @@ -683,7 +683,10 @@ BOOL WINAPI ImeSetCompositionString( HIMC himc, DWORD index, const void *comp, D { UINT msg, flags = GCS_COMPSTR | GCS_COMPCLAUSE | GCS_COMPATTR | GCS_DELTASTART | GCS_CURSORPOS; WCHAR wparam = comp && comp_len >= sizeof(WCHAR) ? *(WCHAR *)comp : 0; - input_context_set_comp_str( ctx, comp, comp_len / sizeof(WCHAR) ); + DWORD len = comp_len / sizeof(WCHAR); + + if (len && comp && !((WCHAR *)comp)[len - 1]) --len; + input_context_set_comp_str( ctx, comp, len ); if ((msg = ime_set_composition_status( himc, TRUE ))) ime_send_message( himc, msg, 0, 0 ); ime_send_message( himc, WM_IME_COMPOSITION, wparam, flags ); } diff --git a/dlls/imm32/tests/imm32.c b/dlls/imm32/tests/imm32.c index 82d33642713..f5b87d328c4 100644 --- a/dlls/imm32/tests/imm32.c +++ b/dlls/imm32/tests/imm32.c @@ -1130,9 +1130,9 @@ static void test_SCS_SETSTR(void) ok(!msg || broken(ends_comp_in_set && msg), "found WM_IME_ENDCOMPOSITION.\n"); alen = ImmGetCompositionStringA(imc, GCS_COMPSTR, cstring, 20); - todo_wine ok(alen == 2 || broken(ends_comp_in_set && !alen), "got %ld.\n", alen); + ok(alen == 2 || broken(ends_comp_in_set && !alen), "got %ld.\n", alen); wlen = ImmGetCompositionStringW(imc, GCS_COMPSTR, wstring, 20); - todo_wine ok(wlen == 4 || broken(ends_comp_in_set && !wlen), "got %ld.\n", wlen); + ok(wlen == 4 || broken(ends_comp_in_set && !wlen), "got %ld.\n", wlen); msg_spy_flush_msgs(); ret = ImmSetCompositionStringW(imc, SCS_SETSTR, L"", 2, NULL, 0); @@ -1141,9 +1141,9 @@ static void test_SCS_SETSTR(void) todo_wine ok(!!msg || broken(ends_comp_in_set && !msg), "did not find WM_IME_ENDCOMPOSITION.\n"); alen = ImmGetCompositionStringA(imc, GCS_COMPSTR, cstring, 20); - todo_wine ok(!alen, "got %ld.\n", alen); + ok(!alen, "got %ld.\n", alen); wlen = ImmGetCompositionStringW(imc, GCS_COMPSTR, wstring, 20); - todo_wine ok(!wlen, "got %ld.\n", alen); + ok(!wlen, "got %ld.\n", alen); msg_spy_flush_msgs(); ret = ImmSetCompositionStringW(imc, SCS_SETSTR, string, sizeof(string), NULL, 2); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11193