diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-05 01:31:51 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-05 01:31:51 +0000 |
commit | 5fc6a04194611a82da93902458fa2b2a16fa1728 (patch) | |
tree | 48c641b2bcf4e354c978c9b2bddadff7d28a2e8f /chrome/browser/autocomplete/autocomplete_edit.cc | |
parent | 263fcaae086bb5ab9f74e0a7208293387e4546e1 (diff) | |
download | chromium_src-5fc6a04194611a82da93902458fa2b2a16fa1728.zip chromium_src-5fc6a04194611a82da93902458fa2b2a16fa1728.tar.gz chromium_src-5fc6a04194611a82da93902458fa2b2a16fa1728.tar.bz2 |
Fix some goofiness when arrowing around the popup with control down by canceling control-enter once the user starts moving around the popup.
BUG=32547
TEST=Type something in the omnibox, hold control, arrow down to a different entry, release control, press enter. You should visit the entry that's selected, not something else.
Review URL: http://codereview.chromium.org/577008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38159 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete/autocomplete_edit.cc')
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_edit.cc | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit.cc b/chrome/browser/autocomplete/autocomplete_edit.cc index 46873ba..70a6661 100644 --- a/chrome/browser/autocomplete/autocomplete_edit.cc +++ b/chrome/browser/autocomplete/autocomplete_edit.cc @@ -349,8 +349,15 @@ bool AutocompleteEditModel::OnEscapeKeyPressed() { void AutocompleteEditModel::OnControlKeyChanged(bool pressed) { // Don't change anything unless the key state is actually toggling. if (pressed == (control_key_state_ == UP)) { + ControlKeyState old_state = control_key_state_; control_key_state_ = pressed ? DOWN_WITHOUT_CHANGE : UP; - if (popup_->IsOpen()) { + if ((control_key_state_ == DOWN_WITHOUT_CHANGE) && has_temporary_text_) { + // Arrowing down and then hitting control accepts the temporary text as + // the input text. + InternalSetUserText(UserTextFromDisplayText(view_->GetText())); + has_temporary_text_ = false; + } + if ((old_state != DOWN_WITH_CHANGE) && popup_->IsOpen()) { // Autocomplete history provider results may change, so refresh the // popup. This will force user_input_in_progress_ to true, but if the // popup is open, that should have already been the case. @@ -424,6 +431,16 @@ void AutocompleteEditModel::OnPopupDataChanged( original_url_ = popup_->URLsForCurrentSelection(NULL, NULL, NULL); original_keyword_ui_state_ = keyword_ui_state_; } + if (control_key_state_ == DOWN_WITHOUT_CHANGE) { + // Arrowing around the popup cancels control-enter. + control_key_state_ = DOWN_WITH_CHANGE; + // Now things are a bit screwy: the desired_tld has changed, but if we + // update the popup, the new order of entries won't match the old, so the + // user's selection gets screwy; and if we don't update the popup, and the + // user reverts, then the selected item will be as if control is still + // pressed, even though maybe it isn't any more. There is no obvious + // right answer here :( + } view_->OnTemporaryTextMaybeChanged(DisplayTextFromUserText(text), save_original_selection); return; |