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