##// END OF EJS Templates
Removing inversion of the completion list.
Brian E. Granger -
Show More
@@ -208,17 +208,13 var IPython = (function (IPython) {
208 var cur = this.editor.getCursor();
208 var cur = this.editor.getCursor();
209 cur.ch = cur.ch-matched_text.length;
209 cur.ch = cur.ch-matched_text.length;
210 var pos = this.editor.cursorCoords(cur);
210 var pos = this.editor.cursorCoords(cur);
211 var invert = false;
212 var left = pos.left-3;
211 var left = pos.left-3;
213 var top;
212 var top;
214 var cheight = this.complete.height();
213 var cheight = this.complete.height();
215 var wheight = $(window).height();
214 var wheight = $(window).height();
216 console.log(pos.bottom, cheight, wheight)
217 if (pos.bottom+cheight+5 > wheight) {
215 if (pos.bottom+cheight+5 > wheight) {
218 invert = true;
219 top = pos.top-cheight-4;
216 top = pos.top-cheight-4;
220 } else {
217 } else {
221 invert = false;
222 top = pos.bottom+1;
218 top = pos.bottom+1;
223 }
219 }
224 this.complete.css('left', left + 'px');
220 this.complete.css('left', left + 'px');
@@ -235,7 +231,7 var IPython = (function (IPython) {
235 that.keydown(event);
231 that.keydown(event);
236 });
232 });
237
233
238 this.build_gui_list(this.raw_result, invert);
234 this.build_gui_list(this.raw_result);
239
235
240 this.sel.focus();
236 this.sel.focus();
241 // Opera sometimes ignores focusing a freshly created node
237 // Opera sometimes ignores focusing a freshly created node
@@ -249,23 +245,13 var IPython = (function (IPython) {
249 this.editor.replaceRange(completion.str, completion.from, completion.to);
245 this.editor.replaceRange(completion.str, completion.from, completion.to);
250 }
246 }
251
247
252 Completer.prototype.build_gui_list = function (completions, invert) {
248 Completer.prototype.build_gui_list = function (completions) {
253 invert = invert || false;
249 for (var i = 0; i < completions.length; ++i) {
254 if (!invert) {
250 var opt = $('<option/>').text(completions[i].str).addClass(completions[i].type);
255 for (var i = 0; i < completions.length; ++i) {
251 this.sel.append(opt);
256 var opt = $('<option/>').text(completions[i].str).addClass(completions[i].type);
257 this.sel.append(opt);
258 }
259 this.sel.children().first().attr('selected', 'true');
260 this.sel.scrollTop(0);
261 } else {
262 for (var i = (completions.length-1); i > -1; --i) {
263 var opt = $('<option/>').text(completions[i].str).addClass(completions[i].type);
264 this.sel.append(opt);
265 }
266 this.sel.children().last().attr('selected', 'true');
267 this.sel.scrollTop(this.sel[0].scrollHeight);
268 }
252 }
253 this.sel.children().first().attr('selected', 'true');
254 this.sel.scrollTop(0);
269 }
255 }
270
256
271 Completer.prototype.close = function () {
257 Completer.prototype.close = function () {
General Comments 0
You need to be logged in to leave comments. Login now