Win32: fix window commits last char when deleting text with IME (flutter/engine#32565)
This commit is contained in:
@@ -212,6 +212,11 @@ void WindowWin32::OnImeComposition(UINT const message,
|
||||
// Update the IME window position.
|
||||
text_input_manager_->UpdateImeWindow();
|
||||
|
||||
if (lparam == 0) {
|
||||
OnComposeChange(u"", 0);
|
||||
OnComposeCommit();
|
||||
}
|
||||
|
||||
if (lparam & GCS_COMPSTR) {
|
||||
// Read the in-progress composing string.
|
||||
long pos = text_input_manager_->GetComposingCursorPosition();
|
||||
|
||||
@@ -115,6 +115,23 @@ TEST(MockWin32Window, OnImeCompositionComposeAndResult) {
|
||||
GCS_COMPSTR | GCS_RESULTSTR);
|
||||
}
|
||||
|
||||
TEST(MockWin32Window, OnImeCompositionClearChange) {
|
||||
MockTextInputManagerWin32* text_input_manager =
|
||||
new MockTextInputManagerWin32();
|
||||
std::unique_ptr<TextInputManagerWin32> text_input_manager_ptr(
|
||||
text_input_manager);
|
||||
MockWin32Window window(std::move(text_input_manager_ptr));
|
||||
EXPECT_CALL(window, OnComposeChange(std::u16string(u""), 0)).Times(1);
|
||||
EXPECT_CALL(window, OnComposeCommit()).Times(1);
|
||||
ON_CALL(window, OnImeComposition)
|
||||
.WillByDefault(Invoke(&window, &MockWin32Window::CallOnImeComposition));
|
||||
EXPECT_CALL(window, OnImeComposition(_, _, _)).Times(1);
|
||||
|
||||
// send an IME_COMPOSITION event that contains both the result string and the
|
||||
// composition string.
|
||||
window.InjectWindowMessage(WM_IME_COMPOSITION, 0, 0);
|
||||
}
|
||||
|
||||
TEST(MockWin32Window, HorizontalScroll) {
|
||||
MockWin32Window window;
|
||||
const int scroll_amount = 10;
|
||||
|
||||
Reference in New Issue
Block a user