##// END OF EJS Templates
Clean code, retab and minor fix...
Matthias BUSSONNIER -
Show More
@@ -11,14 +11,15 b' var IPython = (function(IPython ) {'
11 11
12 12 // what is the common start of all completions
13 13 function sharedStart(B){
14 if(B.length == 1){return B[0]}
15 var A = new Array()
14 if(B.length == 1){return B[0];}
15 var A = new Array();
16 16 for(var i=0; i< B.length; i++)
17 17 {
18 18 A.push(B[i].str);
19 19 }
20 20 if(A.length > 1 ){
21 var tem1, tem2, s, A = A.slice(0).sort();
21 var tem1, tem2, s;
22 A = A.slice(0).sort();
22 23 tem1 = A[0];
23 24 s = tem1.length;
24 25 tem2 = A.pop();
@@ -40,7 +41,7 b' var IPython = (function(IPython ) {'
40 41 this.editor = cell.code_mirror;
41 42 // if last caractere before cursor is not in this, we stop completing
42 43 this.reg = /[0-9a-z.]/i; // casse insensitive
43 }
44 };
44 45
45 46 Completer.prototype.kernelCompletionRequest = function(){
46 47 var cur = this.editor.getCursor();
@@ -48,7 +49,7 b' var IPython = (function(IPython ) {'
48 49 // one could fork here and directly call finish completing if kernel is busy
49 50 var callbacks = {'complete_reply': $.proxy(this.finish_completing,this)};
50 51 IPython.notebook.kernel.complete(line, cur.ch, callbacks);
51 }
52 };
52 53
53 54
54 55 Completer.prototype.startCompletion = function()
@@ -60,7 +61,7 b' var IPython = (function(IPython ) {'
60 61 this.done = false;
61 62 // use to get focus back on opera
62 63 this.carryOnCompletion(true);
63 }
64 };
64 65
65 66 Completer.prototype.carryOnCompletion = function(ff) {
66 67 // Pass true as parameter if you want the commpleter to autopick when
@@ -83,7 +84,7 b' var IPython = (function(IPython ) {'
83 84
84 85 //one kernel completion came back, finish_completing will be called with the results
85 86 this.kernelCompletionRequest();
86 }
87 };
87 88
88 89 Completer.prototype.finish_completing =function (content) {
89 90 // let's build a function that wrap all that stuff into what is needed
@@ -104,7 +105,7 b' var IPython = (function(IPython ) {'
104 105 type : "introspection",
105 106 from : {line: cur.line, ch: cur.ch-matched_text.length},
106 107 to : {line: cur.line, ch: cur.ch}
107 })
108 });
108 109 }
109 110
110 111 // one the 2 sources results have been merge, deal with it
@@ -117,15 +118,14 b' var IPython = (function(IPython ) {'
117 118 if (this.autopick == true && this.raw_result.length == 1)
118 119 {
119 120 this.insert(this.raw_result[0]);
120 return true;
121 return;
121 122 }
122 123
123 124 if (this.raw_result.length == 1)
124 125 {
125 126 // test if first and only completion totally matches
126 127 // what is typed, in this case dismiss
127 var str = this.raw_result[0].str
128 var cur = this.editor.getCursor();
128 var str = this.raw_result[0].str;
129 129 var pre_cursor = this.editor.getRange({line:cur.line,ch:cur.ch-str.length},cur);
130 130 if(pre_cursor == str)
131 131 { this.close(); return ; }
@@ -148,9 +148,9 b' var IPython = (function(IPython ) {'
148 148 $('body').append(this.complete);
149 149 //build the container
150 150 var that = this;
151 this.sel.dblclick(function(){that.pick()});
151 this.sel.dblclick(function(){that.pick();});
152 152 this.sel.blur(this.close);
153 this.sel.keydown(function(event){that.keydown(event)});
153 this.sel.keydown(function(event){that.keydown(event);});
154 154
155 155 this.build_gui_list(this.raw_result);
156 156
@@ -191,6 +191,7 b' var IPython = (function(IPython ) {'
191 191
192 192 Completer.prototype.keydown = function(event) {
193 193 var code = event.keyCode;
194 var that = this;
194 195 // Enter
195 196 if (code == key.enter) {CodeMirror.e_stop(event); this.pick();}
196 197 // Escape or backspace
@@ -209,7 +210,6 b' var IPython = (function(IPython ) {'
209 210 CodeMirror.e_stop(event);
210 211 this.editor.focus();
211 212 //reinvoke self
212 var that = this;
213 213 setTimeout(function(){that.carryOnCompletion();}, 50);
214 214 }
215 215 else if (code == key.upArrow || code == key.downArrow) {
@@ -220,7 +220,6 b' var IPython = (function(IPython ) {'
220 220 else if (code != key.upArrow && code != key.downArrow) {
221 221 this.close(); this.editor.focus();
222 222 //we give focus to the editor immediately and call sell in 50 ms
223 var that = this;
224 223 setTimeout(function(){that.carryOnCompletion();}, 50);
225 224 }
226 225 }
1 NO CONTENT: modified file
@@ -9,7 +9,7 b''
9 9 // Tooltip
10 10 //============================================================================
11 11 //
12 // you can set the autocall time by setting `IPython.notebook.time_before_tooltip` in ms
12 // you can set the autocall time by setting `IPython.tooltip.time_before_tooltip` in ms
13 13
14 14 var IPython = (function (IPython) {
15 15
@@ -95,9 +95,6 b' var IPython = (function (IPython) {'
95 95 this.tooltip.append(this.text);
96 96 };
97 97
98 // will resend the request on behalf on the cell which invoked the tooltip
99 // to show in it in pager. This is done so to be sure of having the same
100 // result as invoking `something?`
101 98 Tooltip.prototype.showInPager = function()
102 99 {
103 100 var that = this;
General Comments 0
You need to be logged in to leave comments. Login now