diff options
author | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2017-07-31 16:16:45 +0300 |
---|---|---|
committer | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2017-08-04 15:50:32 +0000 |
commit | b4f4cffff8f1f8c8a5947c691b689c118bdf26a8 (patch) | |
tree | 774115b50b014a5e4275c43aa32d3cd08a28e567 /src | |
parent | 3e4b20088e48d39949e67ed3b3925bf88796a230 (diff) |
t9write: Fix regression introduced in the T9 Write CJK integration
The T9 Write CJK integration added a new internal function
T9WriteInputMethodPrivate::setContext() used for updating T9 Write
session settings for different layout scenarios (e.g. full screen
mode vs regular layout).
However, this function calls finishRecognition() so it breaks the
input when switching between full screen mode and regular layout.
Fix this regression by preserving input between context changes.
Change-Id: I3ac269247466d34729c9b49c43425af069af69ea
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/virtualkeyboard/t9writeinputmethod.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/virtualkeyboard/t9writeinputmethod.cpp b/src/virtualkeyboard/t9writeinputmethod.cpp index aa47289e..ef86dc8c 100644 --- a/src/virtualkeyboard/t9writeinputmethod.cpp +++ b/src/virtualkeyboard/t9writeinputmethod.cpp @@ -919,7 +919,23 @@ public: VIRTUALKEYBOARD_DEBUG() << "T9WriteInputMethodPrivate::setContext():" << QString(context.toHex()); - finishRecognition(); + // Finish recognition, but preserve current input + Q_Q(T9WriteInputMethod); + QString preeditText = q->inputContext()->preeditText(); + // WA: T9Write CJK may crash in some cases with long stringStart. + // Therefore we don't restore the current input in this mode. + bool preserveCurrentInput = !preeditText.isEmpty() && !cjk; + T9WriteCaseFormatter oldCaseFormatter(caseFormatter); + finishRecognition(!preserveCurrentInput); + + if (preserveCurrentInput) { + caseFormatter = oldCaseFormatter; + stringStart = preeditText; + wordCandidates.append(preeditText); + activeWordIndex = 0; + emit q->selectionListChanged(SelectionListModel::WordCandidateList); + emit q->selectionListActiveItemChanged(SelectionListModel::WordCandidateList, activeWordIndex); + } const int dpi = traceCaptureDeviceInfo.value("dpi", 96).toInt(); static const int INSTANT_GESTURE_WIDTH_THRESHOLD_MM = 25; |