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

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

Issue 8669: A fix for Issue 3156 in chromium: "OmniBox: NavSuggest doesn't work fine when... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 2 months 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.cc
===================================================================
--- chrome/browser/autocomplete/autocomplete_edit.cc (revision 4125)
+++ chrome/browser/autocomplete/autocomplete_edit.cc (working copy)
@@ -305,6 +305,10 @@
void AutocompleteEditModel::AcceptKeyword() {
view_->OnBeforePossibleChange();
+ // NOTE: We don't need the IME composition hack in SetWindowTextAndCaretPos()
+ // here, because any active IME composition will eat <tab> characters,
+ // preventing the user from using tab-to-search until the composition is
+ // ended.
view_->SetWindowText(L"");
is_keyword_hint_ = false;
keyword_ui_state_ = KEYWORD;
@@ -897,6 +901,19 @@
void AutocompleteEditView::SetWindowTextAndCaretPos(const std::wstring& text,
size_t caret_pos) {
+ HIMC imm_context = ImmGetContext(m_hWnd);
+ if (imm_context) {
+ // In Windows Vista, SetWindowText() automatically completes any ongoing
+ // IME composition, and updates the text of the underlying edit control.
+ // In Windows XP, however, SetWindowText() gets applied to the IME
+ // composition string if it exists, and doesn't update the underlying edit
+ // control. To avoid this, we force the IME to complete any outstanding
+ // compositions here. This is harmless in Vista and in cases where the IME
+ // isn't composing.
+ ImmNotifyIME(imm_context, NI_COMPOSITIONSTR, CPS_COMPLETE, 0);
+ ImmReleaseContext(m_hWnd, imm_context);
+ }
+
SetWindowText(text.c_str());
PlaceCaretAt(caret_pos);
}
@@ -1044,6 +1061,9 @@
return false;
ScopedFreeze freeze(this, GetTextObjectModel());
+ // NOTE: We don't need the IME composition hack in SetWindowTextAndCaretPos()
+ // here, because UpdatePopup() disables inline autocomplete when a
+ // composition is in progress, thus preventing us from reaching this code.
SetWindowText(display_text.c_str());
// Set a reversed selection to keep the caret in the same position, which
// avoids scrolling the user's text.
« 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