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); |