mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-12 11:45:38 +08:00
tabs fast forward user tab
This commit is contained in:
parent
27f2b2b876
commit
5e1bd70d36
@ -248,6 +248,20 @@ var IPython = (function (IPython) {
|
|||||||
}
|
}
|
||||||
// end sort kwargs
|
// end sort kwargs
|
||||||
|
|
||||||
|
function sharedStart(A){
|
||||||
|
if(A.length > 1 ){
|
||||||
|
var tem1, tem2, s, A= A.slice(0).sort();
|
||||||
|
tem1= A[0];
|
||||||
|
s= tem1.length;
|
||||||
|
tem2= A.pop();
|
||||||
|
while(s && tem2.indexOf(tem1)== -1){
|
||||||
|
tem1= tem1.substring(0, --s);
|
||||||
|
}
|
||||||
|
return tem1;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
if (!this.is_completing || matches.length === 0) {return;}
|
if (!this.is_completing || matches.length === 0) {return;}
|
||||||
|
|
||||||
//try to check if the user is typing tab at least twice after a word
|
//try to check if the user is typing tab at least twice after a word
|
||||||
@ -377,12 +391,19 @@ var IPython = (function (IPython) {
|
|||||||
// We don't want the document keydown handler to handle UP/DOWN,
|
// We don't want the document keydown handler to handle UP/DOWN,
|
||||||
// but we want the default action.
|
// but we want the default action.
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
} else if ((code>64 && code <=122)|| (code==8 && down)){
|
} else if ((code>64 && code <=122)|| (code==8 && down)||(code==9 && down)){
|
||||||
// issues with _-.. on chrome at least
|
// issues with _-.. on chrome at least
|
||||||
if(code != 8 && press)
|
if(code != 8 && press)
|
||||||
{
|
{
|
||||||
var newchar = String.fromCharCode(code);
|
var newchar = String.fromCharCode(code);
|
||||||
typed_characters=typed_characters+newchar;
|
typed_characters=typed_characters+newchar;
|
||||||
|
} else if (code == 9) {
|
||||||
|
fastForward = sharedStart(filterd)
|
||||||
|
ffsub = fastForward.substr(matched_text.length+typed_characters.length);
|
||||||
|
typed_characters=typed_characters+ffsub;
|
||||||
|
console.log("Fast forded by :"+ffsub);
|
||||||
|
event.stopPropagation();
|
||||||
|
event.preventDefault();
|
||||||
} else if (code == 8) {
|
} else if (code == 8) {
|
||||||
// 8 is backspace remove 1 char cancel if
|
// 8 is backspace remove 1 char cancel if
|
||||||
// user have erase everything, otherwise
|
// user have erase everything, otherwise
|
||||||
|
Loading…
Reference in New Issue
Block a user