Show More
@@ -355,7 +355,14 var IPython = (function (IPython) { | |||
|
355 | 355 | // Give focus to select, and make it filter the match as the user type |
|
356 | 356 | // by filtering the previous matches |
|
357 | 357 | typed_characters = ""; |
|
358 |
|
|
|
358 | var downandpress = function (event,press_or_down) { | |
|
359 | if (press_or_down === 0){ | |
|
360 | press=true; | |
|
361 | down=false; | |
|
362 | } else if (press_or_down == 1){ | |
|
363 | press=false; | |
|
364 | down=true; | |
|
365 | } | |
|
359 | 366 | var code = event.which; |
|
360 | 367 | if (code === 16) { |
|
361 | 368 | // nothing on Shift |
@@ -370,13 +377,13 var IPython = (function (IPython) { | |||
|
370 | 377 | // We don't want the document keydown handler to handle UP/DOWN, |
|
371 | 378 | // but we want the default action. |
|
372 | 379 | event.stopPropagation(); |
|
373 |
} else if (code>64 && code <=122 |
|
|
380 | } else if ((code>64 && code <=122)|| (code==8 && down)){ | |
|
374 | 381 | // issues with _-.. on chrome at least |
|
375 | if(code != 8) | |
|
382 | if(code != 8 && press) | |
|
376 | 383 | { |
|
377 |
var newchar = String.fromCharCode(code) |
|
|
384 | var newchar = String.fromCharCode(code); | |
|
378 | 385 | typed_characters=typed_characters+newchar; |
|
379 | } else { | |
|
386 | } else if (code == 8) { | |
|
380 | 387 | // 8 is backspace remove 1 char cancel if |
|
381 | 388 | // user have erase everything, otherwise |
|
382 | 389 | // decrease what we filter with |
@@ -386,14 +393,20 var IPython = (function (IPython) { | |||
|
386 | 393 | } |
|
387 | 394 | typed_characters=typed_characters.substr(0,typed_characters.length-1); |
|
388 | 395 | } |
|
389 |
re = new RegExp("^"+"\%?"+matched_text+typed_characters," |
|
|
396 | re = new RegExp("^"+"\%?"+matched_text+typed_characters,""); | |
|
390 | 397 | filterd= matches.filter(function(x){return re.test(x)}); |
|
391 | 398 | complete_with(filterd,matched_text+typed_characters); |
|
392 | } else { | |
|
399 | } else if(down){ // abort only on press | |
|
393 | 400 | // abort with what the user have pressed until now |
|
394 | 401 | console.log('aborting with keycode : '+code); |
|
395 | 402 | insert(matched_text+typed_characters); |
|
396 | 403 | } |
|
404 | } | |
|
405 | select.keydown(function (event) { | |
|
406 | downandpress(event,1) | |
|
407 | }); | |
|
408 | select.keypress(function (event) { | |
|
409 | downandpress(event,0) | |
|
397 | 410 | }); |
|
398 | 411 | // Double click also causes a pick. |
|
399 | 412 | // and bind the last actions. |
General Comments 0
You need to be logged in to leave comments.
Login now