aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJarkko Koivikko <jarkko.koivikko@code-q.fi>2021-06-08 15:31:24 +0300
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-06-21 15:07:26 +0000
commit0b33e4bf0d2709079e2fcb27c95f402dd3a8d0c7 (patch)
tree5b1a1499937d494ccb0003c5b7eb3c37e690b351
parentf273b5b7080ea2aca92d98594c5af0f61268b6c7 (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.cpp6
-rw-r--r--tests/auto/inputpanel/data/tst_inputpanel.qml1
2 files changed, 5 insertions, 2 deletions
diff --git a/src/plugins/openwnn/plugin/openwnninputmethod.cpp b/src/plugins/openwnn/plugin/openwnninputmethod.cpp
index b3557cab..9cdce140 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 7496ba40..918cbd42 100644
--- a/tests/auto/inputpanel/data/tst_inputpanel.qml
+++ b/tests/auto/inputpanel/data/tst_inputpanel.qml
@@ -332,6 +332,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 },
]
}