Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Unified Diff: chrome/browser/autocomplete/autocomplete_edit_view_win.cc

Issue 391070: A quick fix for Issue 3798.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autocomplete/autocomplete_edit_view_win.cc
===================================================================
--- chrome/browser/autocomplete/autocomplete_edit_view_win.cc (revision 32137)
+++ chrome/browser/autocomplete/autocomplete_edit_view_win.cc (working copy)
@@ -1252,6 +1252,33 @@
ScopedFreeze freeze(this, GetTextObjectModel());
OnBeforePossibleChange();
LRESULT result = DefWindowProc(message, wparam, lparam);
+
+ // Some IMEs insert whitespace characters instead of input characters while
+ // they are composing text, and trimming these whitespace characters at the
+ // beginning of this control (in OnAfterPossibleChange()) prevents users from
+ // inputting text on these IMEs.
+ // To prevent this problem, we should not start auto-complete if the
+ // composition string starts with whitespace characters.
+ // (When we type a space key to insert a whitespace character, IMEs don't
+ // insert the whitespace character to their composition string but their
+ // result string. So, this code doesn't prevent us from updating autocomplete
+ // when we insert a whitespace character.)
+ if (lparam & GCS_COMPSTR) {
+ std::wstring text;
+ HIMC context = ImmGetContext(m_hWnd);
+ if (context) {
+ int size = ImmGetCompositionString(context, GCS_COMPSTR, NULL, 0);
+ if (size > 0) {
+ wchar_t* text_data = WriteInto(&text, size / sizeof(wchar_t) + 1);
+ if (text_data)
+ ImmGetCompositionString(context, GCS_COMPSTR, text_data, size);
+ }
+ ImmReleaseContext(m_hWnd, context);
+ }
+ if (!text.empty() && IsWhitespace(text[0]))
+ return result;
+ }
+
if (!OnAfterPossibleChange() && (lparam & GCS_RESULTSTR)) {
// The result string changed, but the text in the popup didn't actually
// change. This means the user finalized the composition. Rerun
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698