| Index: chrome/browser/ui/omnibox/omnibox_edit_model.cc
|
| diff --git a/chrome/browser/ui/omnibox/omnibox_edit_model.cc b/chrome/browser/ui/omnibox/omnibox_edit_model.cc
|
| index 5a896518b4950c158196721bb311b55483a2f4cf..a5f2443c4959b9cbec50f72b5126e3ba9bdd5423 100644
|
| --- a/chrome/browser/ui/omnibox/omnibox_edit_model.cc
|
| +++ b/chrome/browser/ui/omnibox/omnibox_edit_model.cc
|
| @@ -91,6 +91,7 @@ OmniboxEditModel::OmniboxEditModel(OmniboxView* view,
|
| controller_(controller),
|
| has_focus_(false),
|
| user_input_in_progress_(false),
|
| + cursor_position_(string16::npos),
|
| just_deleted_text_(false),
|
| has_temporary_text_(false),
|
| is_temporary_text_set_by_instant_(false),
|
| @@ -449,13 +450,13 @@ void OmniboxEditModel::StartAutocomplete(
|
| popup_->SetHoveredLine(OmniboxPopupModel::kNoMatch);
|
| // We don't explicitly clear OmniboxPopupModel::manually_selected_match, as
|
| // Start ends up invoking OmniboxPopupModel::OnResultChanged which clears it.
|
| - autocomplete_controller_->Start(
|
| - user_text_, GetDesiredTLD(),
|
| + autocomplete_controller_->Start(AutocompleteInput(
|
| + user_text_, cursor_position_, GetDesiredTLD(),
|
| prevent_inline_autocomplete || just_deleted_text_ ||
|
| (has_selected_text && inline_autocomplete_text_.empty()) ||
|
| (paste_state_ != NONE), keyword_is_selected,
|
| keyword_is_selected || allow_exact_keyword_match_,
|
| - AutocompleteInput::ALL_MATCHES);
|
| + AutocompleteInput::ALL_MATCHES));
|
| }
|
|
|
| void OmniboxEditModel::StopAutocomplete() {
|
| @@ -966,6 +967,11 @@ bool OmniboxEditModel::OnAfterPossibleChange(const string16& old_text,
|
|
|
| const bool no_selection = selection_start == selection_end;
|
|
|
| + // Update the cursor position based on the current selection. This works fine
|
| + // even if there is |no_selection|.
|
| + cursor_position_ = selection_start >= user_text_.length() ? string16::npos
|
| + : selection_start;
|
| +
|
| // Update the popup for the change, in the process changing to keyword mode
|
| // if the user hit space in mid-string after a keyword.
|
| // |allow_exact_keyword_match_| will be used by StartAutocomplete() method,
|
|
|