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

Unified Diff: chrome/browser/autocomplete/autocomplete_edit_view_mac.mm

Issue 6252003: Accept keyword by pressing space. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Only allow 0x0020 and 0x3000 for now. Created 9 years, 11 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
Index: chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
index 207bd085b1d160e95be83f0c79e88a646e148713..ba9736a32f877ac7888e1e11d45cfe372c920c3c 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
@@ -648,8 +648,9 @@ bool AutocompleteEditViewMac::OnAfterPossibleChange() {
const std::wstring new_text(GetText());
const size_t length = new_text.length();
- const bool selection_differs = !NSEqualRanges(new_selection,
- selection_before_change_);
+ const bool selection_differs =
+ (new_selection.length || selection_before_change_.length) &&
+ !NSEqualRanges(new_selection, selection_before_change_);
const bool at_end_of_edit = (length == new_selection.location);
const bool text_differs = (new_text != text_before_change_) ||
!NSEqualRanges(marked_range_before_change_, GetMarkedRange());
@@ -810,10 +811,8 @@ bool AutocompleteEditViewMac::OnDoCommandBySelector(SEL cmd) {
if (cmd == @selector(insertTab:) ||
cmd == @selector(insertTabIgnoringFieldEditor:)) {
- if (model_->is_keyword_hint() && !model_->keyword().empty()) {
- model_->AcceptKeyword();
- return true;
- }
+ if (model_->is_keyword_hint())
+ return model_->AcceptKeyword();
if (suggest_text_length_ > 0) {
controller_->OnCommitSuggestedText(GetText());
@@ -939,10 +938,8 @@ void AutocompleteEditViewMac::OnPaste() {
NSTextView* editor = static_cast<NSTextView*>([field_ currentEditor]);
const NSRange selectedRange = GetSelectedRange();
if ([editor shouldChangeTextInRange:selectedRange replacementString:s]) {
- // 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
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc ('k') | chrome/browser/autocomplete/autocomplete_edit_view_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698