| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 /** | 4 /** |
| 5 * @unrestricted | 5 * @unrestricted |
| 6 */ | 6 */ |
| 7 Console.ConsolePrompt = class extends UI.Widget { | 7 Console.ConsolePrompt = class extends UI.Widget { |
| 8 constructor() { | 8 constructor() { |
| 9 super(); | 9 super(); |
| 10 this._addCompletionsFromHistory = true; | 10 this._addCompletionsFromHistory = true; |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 var text = this.text(); | 211 var text = this.text(); |
| 212 var set = new Set(); | 212 var set = new Set(); |
| 213 var data = this._history.historyData(); | 213 var data = this._history.historyData(); |
| 214 for (var i = data.length - 1; i >= 0 && result.length < 50; --i) { | 214 for (var i = data.length - 1; i >= 0 && result.length < 50; --i) { |
| 215 var item = data[i]; | 215 var item = data[i]; |
| 216 if (!item.startsWith(text)) | 216 if (!item.startsWith(text)) |
| 217 continue; | 217 continue; |
| 218 if (set.has(item)) | 218 if (set.has(item)) |
| 219 continue; | 219 continue; |
| 220 set.add(item); | 220 set.add(item); |
| 221 result.push({title: item.substring(text.length - prefix.length), className
: 'additional'}); | 221 result.push( |
| 222 {title: item.substring(text.length - prefix.length), iconType: 'smalli
con-text-prompt', isSecondary: true}); |
| 222 } | 223 } |
| 223 return result; | 224 return result; |
| 224 } | 225 } |
| 225 | 226 |
| 226 /** | 227 /** |
| 227 * @override | 228 * @override |
| 228 */ | 229 */ |
| 229 focus() { | 230 focus() { |
| 230 if (this._editor) | 231 if (this._editor) |
| 231 this._editor.widget().focus(); | 232 this._editor.widget().focus(); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 return this._currentHistoryItem(); | 357 return this._currentHistoryItem(); |
| 357 } | 358 } |
| 358 | 359 |
| 359 /** | 360 /** |
| 360 * @return {string|undefined} | 361 * @return {string|undefined} |
| 361 */ | 362 */ |
| 362 _currentHistoryItem() { | 363 _currentHistoryItem() { |
| 363 return this._data[this._data.length - this._historyOffset]; | 364 return this._data[this._data.length - this._historyOffset]; |
| 364 } | 365 } |
| 365 }; | 366 }; |
| OLD | NEW |