| Index: third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js b/third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js
|
| index 0d7ac04e4de2ccd9afa93c0b8f7ba120c15b5f51..6ff3ce32f9abc03ded82e387b325d81c7b48d54f 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js
|
| @@ -278,12 +278,13 @@ WebInspector.SuggestBox = class {
|
| _createItemElement(query, text, className) {
|
| var element = createElementWithClass('div', 'suggest-box-content-item source-code ' + (className || ''));
|
| element.tabIndex = -1;
|
| - if (query && query.length && !text.indexOf(query)) {
|
| - element.createChild('span', 'query').textContent = query;
|
| - element.createChild('span').textContent = text.substring(query.length).trimEnd(50);
|
| - } else {
|
| - element.createChild('span').textContent = text.trimEnd(50);
|
| - }
|
| + var displayText = text.trimEnd(50 + query.length);
|
| + var index = displayText.toLowerCase().indexOf(query.toLowerCase());
|
| + if (index > 0)
|
| + element.createChild('span').textContent = displayText.substring(0, index);
|
| + if (index > -1)
|
| + element.createChild('span', 'query').textContent = displayText.substring(index, index + query.length);
|
| + element.createChild('span').textContent = displayText.substring(index > -1 ? index + query.length : 0);
|
| element.__fullValue = text;
|
| element.createChild('span', 'spacer');
|
| element.addEventListener('mousedown', this._onItemMouseDown.bind(this), false);
|
| @@ -374,6 +375,9 @@ WebInspector.SuggestBox = class {
|
| if (completions.length > 1)
|
| return true;
|
|
|
| + if (!completions[0].title.startsWith(userEnteredText))
|
| + return true;
|
| +
|
| // Do not show a single suggestion if it is the same as user-entered query, even if allowed to show single-item suggest boxes.
|
| return canShowForSingleItem && completions[0].title !== userEnteredText;
|
| }
|
|
|