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