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

Unified Diff: components/omnibox/browser/url_index_private_data.cc

Issue 2842513006: Omnibox - HistoryQuick Provider - Don't Run Duplicate Searches (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/omnibox/browser/url_index_private_data.cc
diff --git a/components/omnibox/browser/url_index_private_data.cc b/components/omnibox/browser/url_index_private_data.cc
index b9f2a93ea945bc2e73e33afdb396d0bd0ef8a975..659828c27181492f2d26dd6f7edfe1645b3922f3 100644
--- a/components/omnibox/browser/url_index_private_data.cc
+++ b/components/omnibox/browser/url_index_private_data.cc
@@ -153,9 +153,12 @@ ScoredHistoryMatches URLIndexPrivateData::HistoryItemsForTerms(
search_strings.push_back(original_search_string);
if ((cursor_position != base::string16::npos) &&
(cursor_position < original_search_string.length()) &&
- (cursor_position > 0)) {
+ (cursor_position > 0) &&
+ (original_search_string[cursor_position - 1] != L' ') &&
+ (original_search_string[cursor_position] != L' ')) {
Peter Kasting 2017/04/26 01:43:02 What about other kinds of whitespace/word breaks?
Mark P 2017/04/26 22:24:44 It uses ICU via the call to String16VectorFromStri
// The original search_string broken at cursor position. This is one type of
- // transformation.
+ // transformation. There is no need to break the cursor position at a space
+ // if there is already a space adjacent to the cursor.
base::string16 transformed_search_string(original_search_string);
transformed_search_string.insert(cursor_position, base::ASCIIToUTF16(" "));
search_strings.push_back(transformed_search_string);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698