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 |