Commit 5e172e98 authored by Tomasz Wiszkowski's avatar Tomasz Wiszkowski Committed by Commit Bot

Fix missing ellipsis on tail suggestions (infinite suggest).

This change drops additional checks that rejected the tail suggestions, if the
offered suggestion also came with additional corrections (spelling, spaces etc).

Bug: 973036
Change-Id: I7186593d698fc22cc94992fe1c8df7827adcb7cd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1719267
Commit-Queue: Ender <ender@google.com>
Reviewed-by: default avatarMark Pearson <mpearson@chromium.org>
Reviewed-by: default avatarTheresa <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#682829}
parent 51d1888e
...@@ -266,24 +266,18 @@ public class BasicSuggestionProcessor implements SuggestionProcessor { ...@@ -266,24 +266,18 @@ public class BasicSuggestionProcessor implements SuggestionProcessor {
if (suggestion.getType() == OmniboxSuggestionType.SEARCH_SUGGEST_TAIL) { if (suggestion.getType() == OmniboxSuggestionType.SEARCH_SUGGEST_TAIL) {
String fillIntoEdit = suggestion.getFillIntoEdit(); String fillIntoEdit = suggestion.getFillIntoEdit();
// Data sanity checks. final String ellipsisPrefix = "\u2026 ";
if (fillIntoEdit.startsWith(userQuery) && fillIntoEdit.endsWith(suggestedQuery) suggestedQuery = ellipsisPrefix + suggestedQuery;
&& fillIntoEdit.length() < userQuery.length() + suggestedQuery.length()) { // Offset the match classifications by the length of the ellipsis prefix to ensure
final String ellipsisPrefix = "\u2026 "; // the highlighting remains correct.
suggestedQuery = ellipsisPrefix + suggestedQuery; for (int i = 0; i < classifications.size(); i++) {
classifications.set(i,
// Offset the match classifications by the length of the ellipsis prefix to ensure
// the highlighting remains correct.
for (int i = 0; i < classifications.size(); i++) {
classifications.set(i,
new OmniboxSuggestion.MatchClassification(
classifications.get(i).offset + ellipsisPrefix.length(),
classifications.get(i).style));
}
classifications.add(0,
new OmniboxSuggestion.MatchClassification( new OmniboxSuggestion.MatchClassification(
0, MatchClassificationStyle.NONE)); classifications.get(i).offset + ellipsisPrefix.length(),
classifications.get(i).style));
} }
classifications.add(
0, new OmniboxSuggestion.MatchClassification(0, MatchClassificationStyle.NONE));
} }
Spannable str = SpannableString.valueOf(suggestedQuery); Spannable str = SpannableString.valueOf(suggestedQuery);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment