summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ime_input.cc
diff options
context:
space:
mode:
authorhbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-04 06:35:01 +0000
committerhbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-04 06:35:01 +0000
commitc82e4519d03a75c6568394b8c3b49de04c53ab0d (patch)
treec5f467ffa1c06ce5d950be1d1e60429395ef66ec /chrome/browser/ime_input.cc
parent1283ba4fe600d3c8cb32b494cbba96fb1eb106e4 (diff)
downloadchromium_src-c82e4519d03a75c6568394b8c3b49de04c53ab0d.zip
chromium_src-c82e4519d03a75c6568394b8c3b49de04c53ab0d.tar.gz
chromium_src-c82e4519d03a75c6568394b8c3b49de04c53ab0d.tar.bz2
A fix for Issue 2768 "IME: Current clause of Japanese IME doesn't appear to reflect its rage change."
This issue is caused by my code that cannot extract a target clause from a composition string when there is an input clause after a target clause. when a user changes the range of a target clause, Japanese IMEs creates a composite clause which consists of a new target clause and an input clause. My IME code treats such composite clause as a target clause and cannot reflect the change. To fix this problem, this code changes the algorithm which extracts a target clause. Review URL: http://codereview.chromium.org/8970 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4569 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ime_input.cc')
-rw-r--r--chrome/browser/ime_input.cc22
1 files changed, 15 insertions, 7 deletions
diff --git a/chrome/browser/ime_input.cc b/chrome/browser/ime_input.cc
index 1b81827..83bd090 100644
--- a/chrome/browser/ime_input.cc
+++ b/chrome/browser/ime_input.cc
@@ -196,15 +196,23 @@ void ImeInput::GetCaret(HIMC imm_context, LPARAM lparam,
if (attribute_data.get()) {
::ImmGetCompositionString(imm_context, GCS_COMPATTR,
attribute_data.get(), attribute_size);
- int i = 0;
- for (; i < attribute_size; i++) {
- if (IsTargetAttribute(attribute_data[i])) break;
+ for (target_start = 0; target_start < attribute_size;
+ ++target_start) {
+ if (IsTargetAttribute(attribute_data[target_start]))
+ break;
}
- target_start = i;
- for (; i < attribute_size; i++) {
- if (!IsTargetAttribute(attribute_data[i])) break;
+ for (target_end = target_start; target_end < attribute_size;
+ ++target_end) {
+ if (!IsTargetAttribute(attribute_data[target_end]))
+ break;
+ }
+ if (target_start == attribute_size) {
+ // This composition clause does not contain any target clauses,
+ // i.e. this clauses is an input clause.
+ // We treat whole this clause as a target clause.
+ target_end = target_start;
+ target_start = 0;
}
- target_end = i;
}
}
}