Chromium Code Reviews| 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 14 matching lines...) Expand all Loading... | |
| 25 this._editor = | 25 this._editor = |
| 26 factory.createEditor({lineNumbers: false, lineWrapping: true, mimeType : 'javascript', autoHeight: true}); | 26 factory.createEditor({lineNumbers: false, lineWrapping: true, mimeType : 'javascript', autoHeight: true}); |
| 27 | 27 |
| 28 this._editor.configureAutocomplete({ | 28 this._editor.configureAutocomplete({ |
| 29 substituteRangeCallback: this._substituteRange.bind(this), | 29 substituteRangeCallback: this._substituteRange.bind(this), |
| 30 suggestionsCallback: this._wordsWithQuery.bind(this), | 30 suggestionsCallback: this._wordsWithQuery.bind(this), |
| 31 captureEnter: true | 31 captureEnter: true |
| 32 }); | 32 }); |
| 33 this._editor.widget().element.addEventListener('keydown', this._editorKeyD own.bind(this), true); | 33 this._editor.widget().element.addEventListener('keydown', this._editorKeyD own.bind(this), true); |
| 34 this._editor.widget().show(this.element); | 34 this._editor.widget().show(this.element); |
| 35 var consoleView = Console.ConsoleView.instance(); | |
|
dgozman
2016/12/14 17:28:43
This looks bad - ConsolePrompt should not reach in
| |
| 36 var onEditorResized = consoleView.scheduleViewportRefresh.bind(consoleView ); | |
| 37 this._editor.widget().addEventListener(UI.TextEditor.Events.EditorResized, onEditorResized); | |
| 35 | 38 |
| 36 this.setText(this._initialText); | 39 this.setText(this._initialText); |
| 37 delete this._initialText; | 40 delete this._initialText; |
| 38 if (this.hasFocus()) | 41 if (this.hasFocus()) |
| 39 this.focus(); | 42 this.focus(); |
| 40 this.element.tabIndex = -1; | 43 this.element.tabIndex = -1; |
| 41 | 44 |
| 42 this._editorSetForTest(); | 45 this._editorSetForTest(); |
| 43 } | 46 } |
| 44 } | 47 } |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 357 return this._currentHistoryItem(); | 360 return this._currentHistoryItem(); |
| 358 } | 361 } |
| 359 | 362 |
| 360 /** | 363 /** |
| 361 * @return {string|undefined} | 364 * @return {string|undefined} |
| 362 */ | 365 */ |
| 363 _currentHistoryItem() { | 366 _currentHistoryItem() { |
| 364 return this._data[this._data.length - this._historyOffset]; | 367 return this._data[this._data.length - this._historyOffset]; |
| 365 } | 368 } |
| 366 }; | 369 }; |
| OLD | NEW |