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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 } | 125 } |
126 break; | 126 break; |
127 case UI.KeyboardShortcut.Keys.N.code: // Ctrl+N = Next | 127 case UI.KeyboardShortcut.Keys.N.code: // Ctrl+N = Next |
128 if (Host.isMac() && keyboardEvent.ctrlKey && !keyboardEvent.metaKey && !
keyboardEvent.altKey && | 128 if (Host.isMac() && keyboardEvent.ctrlKey && !keyboardEvent.metaKey && !
keyboardEvent.altKey && |
129 !keyboardEvent.shiftKey) | 129 !keyboardEvent.shiftKey) |
130 newText = this._history.next(); | 130 newText = this._history.next(); |
131 break; | 131 break; |
132 case UI.KeyboardShortcut.Keys.Enter.code: | 132 case UI.KeyboardShortcut.Keys.Enter.code: |
133 this._enterKeyPressed(keyboardEvent); | 133 this._enterKeyPressed(keyboardEvent); |
134 break; | 134 break; |
| 135 case UI.KeyboardShortcut.Keys.Tab.code: |
| 136 if (!this.text()) |
| 137 keyboardEvent.consume(); |
| 138 break; |
135 } | 139 } |
136 | 140 |
137 if (newText === undefined) | 141 if (newText === undefined) |
138 return; | 142 return; |
139 keyboardEvent.consume(true); | 143 keyboardEvent.consume(true); |
140 this.setText(newText); | 144 this.setText(newText); |
141 | 145 |
142 if (isPrevious) | 146 if (isPrevious) |
143 this._editor.setSelection(TextUtils.TextRange.createFromLocation(0, Infini
ty)); | 147 this._editor.setSelection(TextUtils.TextRange.createFromLocation(0, Infini
ty)); |
144 else | 148 else |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 * @return {string|undefined} | 378 * @return {string|undefined} |
375 */ | 379 */ |
376 _currentHistoryItem() { | 380 _currentHistoryItem() { |
377 return this._data[this._data.length - this._historyOffset]; | 381 return this._data[this._data.length - this._historyOffset]; |
378 } | 382 } |
379 }; | 383 }; |
380 | 384 |
381 Console.ConsolePrompt.Events = { | 385 Console.ConsolePrompt.Events = { |
382 TextChanged: Symbol('TextChanged') | 386 TextChanged: Symbol('TextChanged') |
383 }; | 387 }; |
OLD | NEW |