##// END OF EJS Templates
Merge pull request #7889 from Carreau/after-one-year...
Matthias Bussonnier -
r20597:c552c824 merge
parent child Browse files
Show More
@@ -507,11 +507,12 b' define(['
507 /**
507 /**
508 * turn absolute cursor postion into CodeMirror col, ch cursor
508 * turn absolute cursor postion into CodeMirror col, ch cursor
509 */
509 */
510 var i, line;
510 var i, line, next_line;
511 var offset = 0;
511 var offset = 0;
512 for (i = 0, line=cm.getLine(i); line !== undefined; i++, line=cm.getLine(i)) {
512 for (i = 0, next_line=cm.getLine(i); next_line !== undefined; i++, next_line=cm.getLine(i)) {
513 if (offset + line.length < cursor_pos) {
513 line = next_line;
514 offset += line.length + 1;
514 if (offset + next_line.length < cursor_pos) {
515 offset += next_line.length + 1;
515 } else {
516 } else {
516 return {
517 return {
517 line : i,
518 line : i,
@@ -521,8 +522,8 b' define(['
521 }
522 }
522 // reached end, return endpoint
523 // reached end, return endpoint
523 return {
524 return {
524 ch : line.length - 1,
525 line : i - 1,
525 line : i - 1,
526 ch : line.length - 1,
526 };
527 };
527 };
528 };
528
529
@@ -323,9 +323,10 b' define(['
323
323
324 Completer.prototype.keydown = function (event) {
324 Completer.prototype.keydown = function (event) {
325 var code = event.keyCode;
325 var code = event.keyCode;
326 var that = this;
327
326
328 // Enter
327 // Enter
328 var options;
329 var index;
329 if (code == keycodes.enter) {
330 if (code == keycodes.enter) {
330 event.codemirrorIgnore = true;
331 event.codemirrorIgnore = true;
331 event._ipkmIgnore = true;
332 event._ipkmIgnore = true;
@@ -343,14 +344,11 b' define(['
343 // like %pylab , pylab have no shred start, and ff will result in py<tab><tab>
344 // like %pylab , pylab have no shred start, and ff will result in py<tab><tab>
344 // to erase py
345 // to erase py
345 var sh = shared_start(this.raw_result, true);
346 var sh = shared_start(this.raw_result, true);
346 if (sh) {
347 if (sh.str !== '') {
347 this.insert(sh);
348 this.insert(sh);
348 }
349 }
349 this.close();
350 this.close();
350 //reinvoke self
351 this.carry_on_completion();
351 setTimeout(function () {
352 that.carry_on_completion();
353 }, 50);
354 } else if (code == keycodes.up || code == keycodes.down) {
352 } else if (code == keycodes.up || code == keycodes.down) {
355 // need to do that to be able to move the arrow
353 // need to do that to be able to move the arrow
356 // when on the first or last line ofo a code cell
354 // when on the first or last line ofo a code cell
@@ -358,8 +356,8 b' define(['
358 event._ipkmIgnore = true;
356 event._ipkmIgnore = true;
359 event.preventDefault();
357 event.preventDefault();
360
358
361 var options = this.sel.find('option');
359 options = this.sel.find('option');
362 var index = this.sel[0].selectedIndex;
360 index = this.sel[0].selectedIndex;
363 if (code == keycodes.up) {
361 if (code == keycodes.up) {
364 index--;
362 index--;
365 }
363 }
@@ -371,8 +369,8 b' define(['
371 } else if (code == keycodes.pageup || code == keycodes.pagedown) {
369 } else if (code == keycodes.pageup || code == keycodes.pagedown) {
372 event._ipkmIgnore = true;
370 event._ipkmIgnore = true;
373
371
374 var options = this.sel.find('option');
372 options = this.sel.find('option');
375 var index = this.sel[0].selectedIndex;
373 index = this.sel[0].selectedIndex;
376 if (code == keycodes.pageup) {
374 if (code == keycodes.pageup) {
377 index -= 10; // As 10 is the hard coded size of the drop down menu
375 index -= 10; // As 10 is the hard coded size of the drop down menu
378 } else {
376 } else {
General Comments 0
You need to be logged in to leave comments. Login now