Show More
@@ -66,7 +66,6 var IPython = (function (IPython) { | |||||
66 | if (this.is_completing && this.completion_cursor !== editor.getCursor()) { |
|
66 | if (this.is_completing && this.completion_cursor !== editor.getCursor()) { | |
67 | this.is_completing = false; |
|
67 | this.is_completing = false; | |
68 | this.completion_cursor = null; |
|
68 | this.completion_cursor = null; | |
69 | console.log("Stopped completing early"); |
|
|||
70 | } |
|
69 | } | |
71 | return false; |
|
70 | return false; | |
72 | }; |
|
71 | }; |
@@ -57,11 +57,10 var IPython = (function (IPython) { | |||||
57 | that.select_next(); |
|
57 | that.select_next(); | |
58 | }; |
|
58 | }; | |
59 | } else if (event.which === 13 && event.shiftKey) { |
|
59 | } else if (event.which === 13 && event.shiftKey) { | |
60 |
that.execute_selected_cell( |
|
60 | that.execute_selected_cell(); | |
61 | return false; |
|
61 | return false; | |
62 | } else if (event.which === 13 && event.ctrlKey) { |
|
62 | } else if (event.which === 13 && event.ctrlKey) { | |
63 |
that.execute_selected_cell( |
|
63 | that.execute_selected_cell({terminal:true}); | |
64 | that.selected_cell().clear_input(); |
|
|||
65 | return false; |
|
64 | return false; | |
66 | }; |
|
65 | }; | |
67 | }); |
|
66 | }); | |
@@ -463,8 +462,11 var IPython = (function (IPython) { | |||||
463 | }; |
|
462 | }; | |
464 |
|
463 | |||
465 |
|
464 | |||
466 |
Notebook.prototype.execute_selected_cell = function ( |
|
465 | Notebook.prototype.execute_selected_cell = function (options) { | |
467 | if (add_new === undefined) {add_new = true;}; |
|
466 | // add_new: should a new cell be added if we are at the end of the nb | |
|
467 | // terminal: execute in terminal mode, which stays in the current cell | |||
|
468 | default_options = {terminal: false, add_new: true} | |||
|
469 | $.extend(default_options, options) | |||
468 | var that = this; |
|
470 | var that = this; | |
469 | var cell = that.selected_cell(); |
|
471 | var cell = that.selected_cell(); | |
470 | var cell_index = that.find_cell_index(cell); |
|
472 | var cell_index = that.find_cell_index(cell); | |
@@ -492,12 +494,16 var IPython = (function (IPython) { | |||||
492 | } else if (cell instanceof IPython.TextCell) { |
|
494 | } else if (cell instanceof IPython.TextCell) { | |
493 | cell.render(); |
|
495 | cell.render(); | |
494 | } |
|
496 | } | |
495 | if ((cell_index === (that.ncells()-1)) && add_new) { |
|
497 | if (default_options.terminal) { | |
496 | that.insert_code_cell_after(); |
|
498 | cell.clear_input(); | |
497 | // If we are adding a new cell at the end, scroll down to show it. |
|
|||
498 | that.scroll_to_bottom(); |
|
|||
499 | } else { |
|
499 | } else { | |
500 | that.select(cell_index+1); |
|
500 | if ((cell_index === (that.ncells()-1)) && default_options.add_new) { | |
|
501 | that.insert_code_cell_after(); | |||
|
502 | // If we are adding a new cell at the end, scroll down to show it. | |||
|
503 | that.scroll_to_bottom(); | |||
|
504 | } else { | |||
|
505 | that.select(cell_index+1); | |||
|
506 | }; | |||
501 | }; |
|
507 | }; | |
502 | }; |
|
508 | }; | |
503 |
|
509 | |||
@@ -506,7 +512,7 var IPython = (function (IPython) { | |||||
506 | var ncells = this.ncells(); |
|
512 | var ncells = this.ncells(); | |
507 | for (var i=0; i<ncells; i++) { |
|
513 | for (var i=0; i<ncells; i++) { | |
508 | this.select(i); |
|
514 | this.select(i); | |
509 | this.execute_selected_cell(false); |
|
515 | this.execute_selected_cell({add_new:false}); | |
510 | }; |
|
516 | }; | |
511 | this.scroll_to_bottom(); |
|
517 | this.scroll_to_bottom(); | |
512 | }; |
|
518 | }; |
General Comments 0
You need to be logged in to leave comments.
Login now