OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
279 /** | 279 /** |
280 * @param {!Event} event | 280 * @param {!Event} event |
281 */ | 281 */ |
282 onKeyDown: function(event) | 282 onKeyDown: function(event) |
283 { | 283 { |
284 var handled = false; | 284 var handled = false; |
285 delete this._needUpdateAutocomplete; | 285 delete this._needUpdateAutocomplete; |
286 | 286 |
287 switch (event.keyIdentifier) { | 287 switch (event.keyIdentifier) { |
288 case "U+0009": // Tab | 288 case "U+0009": // Tab |
289 handled = this.tabKeyPressed(event); | 289 // Accept autocomplete suggestion. |
pfeldman
2016/01/22 01:09:08
Looked at the code. So you should leave this as is
samli
2016/01/22 01:17:27
Done - used acceptAutoComplete() instead since tha
| |
290 if (this.isSuggestBoxVisible()) | |
291 handled = this._suggestBox.enterKeyPressed(); | |
292 else | |
293 handled = this.tabKeyPressed(event); | |
290 break; | 294 break; |
291 case "Left": | 295 case "Left": |
292 case "Home": | 296 case "Home": |
293 this._removeSuggestionAids(); | 297 this._removeSuggestionAids(); |
294 break; | 298 break; |
295 case "Right": | 299 case "Right": |
pfeldman
2016/01/22 01:21:20
Or even better add Tab to the bunch and it'll do t
samli
2016/01/22 03:13:08
StylesSidebarPane overrides tabKeyPressed(). Also
| |
296 case "End": | 300 case "End": |
297 if (this.isCaretAtEndOfPrompt()) | 301 if (this.isCaretAtEndOfPrompt()) |
298 handled = this.acceptAutoComplete(); | 302 handled = this.acceptAutoComplete(); |
299 else | 303 else |
300 this._removeSuggestionAids(); | 304 this._removeSuggestionAids(); |
301 break; | 305 break; |
302 case "U+001B": // Esc | 306 case "U+001B": // Esc |
303 if (this.isSuggestBoxVisible()) { | 307 if (this.isSuggestBoxVisible()) { |
304 this._removeSuggestionAids(); | 308 this._removeSuggestionAids(); |
305 handled = true; | 309 handled = true; |
306 } | 310 } |
307 break; | 311 break; |
308 case "U+0020": // Space | 312 case "U+0020": // Space |
309 if (event.ctrlKey && !event.metaKey && !event.altKey && !event.shift Key) { | 313 if (event.ctrlKey && !event.metaKey && !event.altKey && !event.shift Key) { |
310 this._updateAutoComplete(true); | 314 this._updateAutoComplete(true); |
311 handled = true; | 315 handled = true; |
312 } | 316 } |
313 break; | 317 break; |
314 case "Alt": | 318 case "Alt": |
315 case "Meta": | 319 case "Meta": |
316 case "Shift": | 320 case "Shift": |
317 case "Control": | 321 case "Control": |
318 break; | 322 break; |
319 } | 323 } |
320 | 324 |
321 if (!handled && this.isSuggestBoxVisible()) | 325 if (!handled && this.isSuggestBoxVisible() && !isEnterKey(event)) |
pfeldman
2016/01/22 01:09:08
You should simply start onKeyDown with
if (isEnte
samli
2016/01/22 01:17:27
Done.
| |
322 handled = this._suggestBox.keyPressed(event); | 326 handled = this._suggestBox.keyPressed(event); |
323 | 327 |
324 if (!handled) | 328 if (!handled) |
325 this._needUpdateAutocomplete = true; | 329 this._needUpdateAutocomplete = true; |
326 | 330 |
327 if (handled) | 331 if (handled) |
328 event.consume(true); | 332 event.consume(true); |
329 }, | 333 }, |
330 | 334 |
331 /** | 335 /** |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
965 | 969 |
966 return; | 970 return; |
967 } | 971 } |
968 | 972 |
969 WebInspector.TextPrompt.prototype.onKeyDown.apply(this, arguments); | 973 WebInspector.TextPrompt.prototype.onKeyDown.apply(this, arguments); |
970 }, | 974 }, |
971 | 975 |
972 __proto__: WebInspector.TextPrompt.prototype | 976 __proto__: WebInspector.TextPrompt.prototype |
973 } | 977 } |
974 | 978 |
OLD | NEW |