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

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: Fix a bug on Windows when using an IME. 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..1d9323d5c5b6a2f07b604d07a62f801e802cc912 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,7 +812,7 @@ bool AutocompleteEditViewMac::OnDoCommandBySelector(SEL cmd) {
if (cmd == @selector(insertTab:) ||
cmd == @selector(insertTabIgnoringFieldEditor:)) {
- if (model_->is_keyword_hint() && !model_->keyword().empty()) {
+ if (model_->is_keyword_hint()) {
model_->AcceptKeyword();
return true;
}
@@ -942,8 +943,7 @@ void AutocompleteEditViewMac::OnPaste() {
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();
+ model_->OnPaste(IsSelectAll());
// 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