Show More
@@ -244,9 +244,20 b' var IPython = (function (IPython) {' | |||
|
244 | 244 | space:13, |
|
245 | 245 | shift:16, |
|
246 | 246 | enter:32, |
|
247 |
// _ is |
|
|
247 | // _ is 95 | |
|
248 | 248 | isCompSymbol : function (code) |
|
249 | {return ((code>64 && code <=122)|| code == 189)} | |
|
249 | { | |
|
250 | return (code > 64 && code <= 90) | |
|
251 | || (code >= 97 && code <= 122) | |
|
252 | || (code == 95) | |
|
253 | }, | |
|
254 | dismissAndAppend : function (code) | |
|
255 | { | |
|
256 | chararr=['(',')','[',']','+','-','/','\\','.']; | |
|
257 | codearr=chararr.map(function(x){return x.charCodeAt(0)}); | |
|
258 | return jQuery.inArray(code, codearr)!=-1; | |
|
259 | } | |
|
260 | ||
|
250 | 261 | } |
|
251 | 262 | |
|
252 | 263 | // smart completion, sort kwarg ending with '=' |
@@ -409,6 +420,12 b' var IPython = (function (IPython) {' | |||
|
409 | 420 | // nothing on Shift |
|
410 | 421 | return; |
|
411 | 422 | } |
|
423 | if (key.dismissAndAppend(code) && press) { | |
|
424 | var newchar = String.fromCharCode(code); | |
|
425 | typed_characters=typed_characters+newchar; | |
|
426 | insert(matched_text+typed_characters,event); | |
|
427 | return | |
|
428 | } | |
|
412 | 429 | if (code === key.space || code === key.enter) { |
|
413 | 430 | // Pressing SPACE or ENTER will cause a pick |
|
414 | 431 | event.stopPropagation(); |
@@ -418,8 +435,7 b' var IPython = (function (IPython) {' | |||
|
418 | 435 | // We don't want the document keydown handler to handle UP/DOWN, |
|
419 | 436 | // but we want the default action. |
|
420 | 437 | event.stopPropagation(); |
|
421 |
|
|
|
422 | } else if ( (code==key.backspace)||(code==key.tab && down) || press || key.isCompSymbol(code)){ | |
|
438 | } else if ( (code==key.backspace)||(code==key.tab && down) || press || key.isCompSymbol(code)){ | |
|
423 | 439 | if( key.isCompSymbol(code) && press) |
|
424 | 440 | { |
|
425 | 441 | var newchar = String.fromCharCode(code); |
@@ -437,13 +453,19 b' var IPython = (function (IPython) {' | |||
|
437 | 453 | if (typed_characters.length <= 0) |
|
438 | 454 | { |
|
439 | 455 | insert(matched_text,event) |
|
456 | return | |
|
440 | 457 | } |
|
441 | 458 | typed_characters=typed_characters.substr(0,typed_characters.length-1); |
|
442 | }else{return} | |
|
459 | } else if (press && code != key.backspace && code != key.tab && code != 0){ | |
|
460 | insert(matched_text+typed_characters,event); | |
|
461 | return | |
|
462 | } else { | |
|
463 | return | |
|
464 | } | |
|
443 | 465 | re = new RegExp("^"+"\%?"+matched_text+typed_characters,""); |
|
444 | 466 | filterd = matches.filter(function(x){return re.test(x)}); |
|
445 | 467 | complete_with(filterd,matched_text+typed_characters,autopick,event); |
|
446 |
} else if( |
|
|
468 | } else if( press || code==key.esc){ // abort only on .keypress or esc | |
|
447 | 469 | // abort with what the user have pressed until now |
|
448 | 470 | console.log('aborting with keycode : '+code+' is down :'+down); |
|
449 | 471 | insert(matched_text+typed_characters,event); |
General Comments 0
You need to be logged in to leave comments.
Login now