diff options
author | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2021-06-08 15:31:24 +0300 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-06-21 15:22:24 +0000 |
commit | a704c8a341416ea8e249eb9992777eff55148b00 (patch) | |
tree | 7777ef2ac84611c26fdcc2a72b72b4a97619b84a | |
parent | 005e6f28e52d1e3400a91e6180eb7ac8cb4ba0a0 (diff) |
plugins/openwnn: reset() should not modify pre-edit text
Per contract, the reset() function should not modify pre-edit text.
This method is called by the input engine when the input method
needs to be reset. The input method must reset its internal state
only. The main difference to the update() method is that reset()
modifies only the input method state, i.e. it must not modify the
input context.
Fix by clearing the internal state to avoid modifying pre-edit text.
Task-number: QTBUG-94017
Change-Id: I4482188bbe18292d3ef1721e529f09c6054baa5d
Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
(cherry picked from commit b9c70451ec5cb08bc9f823d4c3cf240a4f9931b1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/plugins/openwnn/plugin/openwnninputmethod.cpp | 6 | ||||
-rw-r--r-- | tests/auto/inputpanel/data/tst_inputpanel.qml | 1 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/plugins/openwnn/plugin/openwnninputmethod.cpp b/src/plugins/openwnn/plugin/openwnninputmethod.cpp index 52405dca..cedebb29 100644 --- a/src/plugins/openwnn/plugin/openwnninputmethod.cpp +++ b/src/plugins/openwnn/plugin/openwnninputmethod.cpp @@ -814,7 +814,7 @@ void OpenWnnInputMethod::selectionListItemSelected(QVirtualKeyboardSelectionList void OpenWnnInputMethod::reset() { Q_D(OpenWnnInputMethod); - d->commitAll(); + d->composingText.clear(); d->initializeScreen(); d->fitInputType(); } @@ -822,8 +822,10 @@ void OpenWnnInputMethod::reset() void OpenWnnInputMethod::update() { Q_D(OpenWnnInputMethod); - if (!d->disableUpdate) + if (!d->disableUpdate) { + d->commitAll(); reset(); + } } } // namespace QtVirtualKeyboard diff --git a/tests/auto/inputpanel/data/tst_inputpanel.qml b/tests/auto/inputpanel/data/tst_inputpanel.qml index e8ea08d8..fc129e21 100644 --- a/tests/auto/inputpanel/data/tst_inputpanel.qml +++ b/tests/auto/inputpanel/data/tst_inputpanel.qml @@ -324,6 +324,7 @@ Rectangle { function test_hardKeyBackspaceClearsInput_data() { return [ { initLocale: "en_GB", initText: "12345", initCursorPosition: 1, inputSequence: "hello", outputText: "12345", expectedCursorPosition: 1 }, + { initLocale: "ja_JP", initText: "12345", initCursorPosition: 1, inputSequence: "watashi", outputText: "12345", expectedCursorPosition: 1 }, ] } |