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

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: Update 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 19040b5fbd5a7a9b6f4bc168107a9e1793b88939..d2071fcf4c90c4404b421079021d7572fb510db8 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
@@ -649,8 +649,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());
@@ -811,10 +812,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());
@@ -940,10 +939,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

Powered by Google App Engine
This is Rietveld 408576698