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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 130 |
131 if (newText === undefined) | 131 if (newText === undefined) |
132 return; | 132 return; |
133 keyboardEvent.consume(true); | 133 keyboardEvent.consume(true); |
134 this.setText(newText); | 134 this.setText(newText); |
135 | 135 |
136 if (isPrevious) | 136 if (isPrevious) |
137 this._editor.setSelection(Common.TextRange.createFromLocation(0, Infinity)
); | 137 this._editor.setSelection(Common.TextRange.createFromLocation(0, Infinity)
); |
138 else | 138 else |
139 this.moveCaretToEndOfPrompt(); | 139 this.moveCaretToEndOfPrompt(); |
| 140 this.setMinimumSize(0, this._editor.widget().element.offsetHeight); |
140 } | 141 } |
141 | 142 |
142 /** | 143 /** |
143 * @param {!KeyboardEvent} event | 144 * @param {!KeyboardEvent} event |
144 */ | 145 */ |
145 _enterKeyPressed(event) { | 146 _enterKeyPressed(event) { |
146 if (event.altKey || event.ctrlKey || event.shiftKey) | 147 if (event.altKey || event.ctrlKey || event.shiftKey) |
147 return; | 148 return; |
148 | 149 |
149 event.consume(true); | 150 event.consume(true); |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 return this._currentHistoryItem(); | 358 return this._currentHistoryItem(); |
358 } | 359 } |
359 | 360 |
360 /** | 361 /** |
361 * @return {string|undefined} | 362 * @return {string|undefined} |
362 */ | 363 */ |
363 _currentHistoryItem() { | 364 _currentHistoryItem() { |
364 return this._data[this._data.length - this._historyOffset]; | 365 return this._data[this._data.length - this._historyOffset]; |
365 } | 366 } |
366 }; | 367 }; |
OLD | NEW |