##// END OF EJS Templates
tabs fast forward user tab
Matthias BUSSONNIER -
Show More
@@ -248,6 +248,20 b' var IPython = (function (IPython) {'
248 }
248 }
249 // end sort kwargs
249 // end sort kwargs
250
250
251 function sharedStart(A){
252 if(A.length > 1 ){
253 var tem1, tem2, s, A= A.slice(0).sort();
254 tem1= A[0];
255 s= tem1.length;
256 tem2= A.pop();
257 while(s && tem2.indexOf(tem1)== -1){
258 tem1= tem1.substring(0, --s);
259 }
260 return tem1;
261 }
262 return "";
263 }
264
251 if (!this.is_completing || matches.length === 0) {return;}
265 if (!this.is_completing || matches.length === 0) {return;}
252
266
253 //try to check if the user is typing tab at least twice after a word
267 //try to check if the user is typing tab at least twice after a word
@@ -377,12 +391,19 b' var IPython = (function (IPython) {'
377 // We don't want the document keydown handler to handle UP/DOWN,
391 // We don't want the document keydown handler to handle UP/DOWN,
378 // but we want the default action.
392 // but we want the default action.
379 event.stopPropagation();
393 event.stopPropagation();
380 } else if ((code>64 && code <=122)|| (code==8 && down)){
394 } else if ((code>64 && code <=122)|| (code==8 && down)||(code==9 && down)){
381 // issues with _-.. on chrome at least
395 // issues with _-.. on chrome at least
382 if(code != 8 && press)
396 if(code != 8 && press)
383 {
397 {
384 var newchar = String.fromCharCode(code);
398 var newchar = String.fromCharCode(code);
385 typed_characters=typed_characters+newchar;
399 typed_characters=typed_characters+newchar;
400 } else if (code == 9) {
401 fastForward = sharedStart(filterd)
402 ffsub = fastForward.substr(matched_text.length+typed_characters.length);
403 typed_characters=typed_characters+ffsub;
404 console.log("Fast forded by :"+ffsub);
405 event.stopPropagation();
406 event.preventDefault();
386 } else if (code == 8) {
407 } else if (code == 8) {
387 // 8 is backspace remove 1 char cancel if
408 // 8 is backspace remove 1 char cancel if
388 // user have erase everything, otherwise
409 // user have erase everything, otherwise
General Comments 0
You need to be logged in to leave comments. Login now