summaryrefslogtreecommitdiffstats
path: root/src/gui/inputmethod/qwininputcontext_win.cpp
diff options
context:
space:
mode:
authorKim Motoyoshi Kalland <kim.kalland@nokia.com>2009-10-29 09:13:18 (GMT)
committerKim Motoyoshi Kalland <kim.kalland@nokia.com>2009-10-29 09:13:18 (GMT)
commitf5c553078b7381c3dff7d0bd6b9990a7acf86abb (patch)
treef374978ef75cda27dfa4e9069c2fb170cf0a2390 /src/gui/inputmethod/qwininputcontext_win.cpp
parent69216ca888373e8ca82dfe75fd940fc2ab824c2c (diff)
downloadQt-f5c553078b7381c3dff7d0bd6b9990a7acf86abb.zip
Qt-f5c553078b7381c3dff7d0bd6b9990a7acf86abb.tar.gz
Qt-f5c553078b7381c3dff7d0bd6b9990a7acf86abb.tar.bz2
Fixed highlighting of string components when inputting Japanese text.
After typing a sentence in Japanese, and before committing the sentence, you can select each component and choose a different character representation for it. This commit fixes highlighting of the currently selected sentence component which was broken by commit 55137901. Reviewed-by: Marius Storm-Olsen
Diffstat (limited to 'src/gui/inputmethod/qwininputcontext_win.cpp')
-rw-r--r--src/gui/inputmethod/qwininputcontext_win.cpp25
1 files changed, 5 insertions, 20 deletions
diff --git a/src/gui/inputmethod/qwininputcontext_win.cpp b/src/gui/inputmethod/qwininputcontext_win.cpp
index e9ab870..ef2f5c0 100644
--- a/src/gui/inputmethod/qwininputcontext_win.cpp
+++ b/src/gui/inputmethod/qwininputcontext_win.cpp
@@ -327,28 +327,13 @@ static int getCursorPosition(HIMC himc)
static QString getString(HIMC himc, DWORD dwindex, int *selStart = 0, int *selLength = 0)
{
- static wchar_t *buffer = 0;
- static int buflen = 0;
-
- int len = getCompositionString(himc, dwindex, 0, 0) + 1;
- if (!buffer || len > buflen) {
- delete [] buffer;
- buflen = qMin(len, 256);
- buffer = new wchar_t[buflen];
- }
-
- len = getCompositionString(himc, dwindex, buffer, buflen * sizeof(wchar_t));
+ const int bufferSize = 256;
+ wchar_t buffer[bufferSize];
+ int len = getCompositionString(himc, dwindex, buffer, bufferSize * sizeof(wchar_t));
if (selStart) {
- static wchar_t *attrbuffer = 0;
- static int attrbuflen = 0;
- int attrlen = getCompositionString(himc, dwindex, 0, 0) + 1;
- if (!attrbuffer || attrlen> attrbuflen) {
- delete [] attrbuffer;
- attrbuflen = qMin(attrlen, 256);
- attrbuffer = new wchar_t[attrbuflen];
- }
- attrlen = getCompositionString(himc, GCS_COMPATTR, attrbuffer, attrbuflen * sizeof(wchar_t));
+ char attrbuffer[bufferSize];
+ int attrlen = getCompositionString(himc, GCS_COMPATTR, attrbuffer, bufferSize);
*selStart = attrlen+1;
*selLength = -1;
for (int i = 0; i < attrlen; i++) {