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. |
290 if (this.isSuggestBoxVisible()) | |
291 handled = this._suggestBox.enterKeyPressed(); | |
pfeldman
2016/01/21 19:23:38
Do you want to dispatch tabKeyPressed otherwise?
samli
2016/01/21 23:03:47
Yes, done.
| |
290 break; | 292 break; |
291 case "Left": | 293 case "Left": |
292 case "Home": | 294 case "Home": |
293 this._removeSuggestionAids(); | 295 this._removeSuggestionAids(); |
294 break; | 296 break; |
295 case "Right": | 297 case "Right": |
296 case "End": | 298 case "End": |
297 if (this.isCaretAtEndOfPrompt()) | 299 if (this.isCaretAtEndOfPrompt()) |
298 handled = this.acceptAutoComplete(); | 300 handled = this.acceptAutoComplete(); |
299 else | 301 else |
(...skipping 11 matching lines...) Expand all Loading... | |
311 handled = true; | 313 handled = true; |
312 } | 314 } |
313 break; | 315 break; |
314 case "Alt": | 316 case "Alt": |
315 case "Meta": | 317 case "Meta": |
316 case "Shift": | 318 case "Shift": |
317 case "Control": | 319 case "Control": |
318 break; | 320 break; |
319 } | 321 } |
320 | 322 |
321 if (!handled && this.isSuggestBoxVisible()) | 323 if (!handled && this.isSuggestBoxVisible() && event.keyIdentifier !== "E nter") |
pfeldman
2016/01/21 19:23:38
isEnterKey(event) is how we check for Enter. Why d
samli
2016/01/21 23:03:47
Done. Allowing enter in suggest box will do the ol
| |
322 handled = this._suggestBox.keyPressed(event); | 324 handled = this._suggestBox.keyPressed(event); |
323 | 325 |
324 if (!handled) | 326 if (!handled) |
325 this._needUpdateAutocomplete = true; | 327 this._needUpdateAutocomplete = true; |
326 | 328 |
327 if (handled) | 329 if (handled) |
328 event.consume(true); | 330 event.consume(true); |
329 }, | 331 }, |
330 | 332 |
331 /** | 333 /** |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
965 | 967 |
966 return; | 968 return; |
967 } | 969 } |
968 | 970 |
969 WebInspector.TextPrompt.prototype.onKeyDown.apply(this, arguments); | 971 WebInspector.TextPrompt.prototype.onKeyDown.apply(this, arguments); |
970 }, | 972 }, |
971 | 973 |
972 __proto__: WebInspector.TextPrompt.prototype | 974 __proto__: WebInspector.TextPrompt.prototype |
973 } | 975 } |
974 | 976 |
OLD | NEW |