summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
diff options
context:
space:
mode:
authorsuzhe@google.com <suzhe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-20 21:18:07 +0000
committersuzhe@google.com <suzhe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-20 21:18:07 +0000
commit96ed237d4c3d8cd9d1a16851b7094b476c6c95e9 (patch)
tree7a5b42328cbd7e1dd3ac986363fa99191ba9b89d /chrome/browser/autocomplete/autocomplete_edit_view_win.cc
parente9f575064ea212023b82ec27e36905a066cfc76d (diff)
downloadchromium_src-96ed237d4c3d8cd9d1a16851b7094b476c6c95e9.zip
chromium_src-96ed237d4c3d8cd9d1a16851b7094b476c6c95e9.tar.gz
chromium_src-96ed237d4c3d8cd9d1a16851b7094b476c6c95e9.tar.bz2
Accept keyword by pressing space.
This CL disables implicit keyword accepting completely. The user can only accept a keyword by pressing Tab or space explicitly while the keyword hint UI is visible. BUG=60972 TEST=interactive_ui_tests --gtest_filter=AutocompleteEditViewTest.AcceptKeywordBySpace Review URL: http://codereview.chromium.org/6252003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72003 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete/autocomplete_edit_view_win.cc')
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_win.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
index bdc978f..9e2a820 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
@@ -861,8 +861,11 @@ bool AutocompleteEditViewWin::OnAfterPossibleChangeInternal(
new_sel.cpMax = length;
SetSelectionRange(new_sel);
}
- const bool selection_differs = (new_sel.cpMin != sel_before_change_.cpMin) ||
- (new_sel.cpMax != sel_before_change_.cpMax);
+ const bool selection_differs =
+ ((new_sel.cpMin != new_sel.cpMax) ||
+ (sel_before_change_.cpMin != sel_before_change_.cpMax)) &&
+ ((new_sel.cpMin != sel_before_change_.cpMin) ||
+ (new_sel.cpMax != sel_before_change_.cpMax));
const bool at_end_of_edit =
(new_sel.cpMin == length) && (new_sel.cpMax == length);
@@ -1690,10 +1693,8 @@ void AutocompleteEditViewWin::OnPaste() {
// Replace the selection if we have something to paste.
const std::wstring text(GetClipboardText());
if (!text.empty()) {
- // If this paste will be replacing all the text, record that, so we can do
- // different behaviors in such a case.
- if (IsSelectAll())
- model_->on_paste_replacing_all();
+ // Record this paste, so we can do different behavior.
+ model_->on_paste();
// Force a Paste operation to trigger the text_changed code in
// OnAfterPossibleChange(), even if identical contents are pasted into the
// text box.
@@ -1972,7 +1973,7 @@ bool AutocompleteEditViewWin::OnKeyDownOnlyWritable(TCHAR key,
}
case VK_TAB: {
- if (model_->is_keyword_hint() && !model_->keyword().empty()) {
+ if (model_->is_keyword_hint()) {
// Accept the keyword.
ScopedFreeze freeze(this, GetTextObjectModel());
model_->AcceptKeyword();