CTRL-ENTER now runs a cell in "terminal mode"

In this mode, a new cell is not created after the current cell
is run. Once the cell is run, the current input is cleared, so
it acts just like the terminal.
This commit is contained in:
Brian E. Granger 2011-07-27 09:13:29 -07:00
parent 64273fa929
commit 5519c01de3
2 changed files with 9 additions and 0 deletions

View File

@ -228,6 +228,11 @@ var IPython = (function (IPython) {
};
CodeCell.prototype.clear_input = function () {
this.code_mirror.setValue('');
};
CodeCell.prototype.collapse = function () {
this.element.find('div.output').hide();
};

View File

@ -59,6 +59,10 @@ var IPython = (function (IPython) {
} else if (event.which === 13 && event.shiftKey) {
that.execute_selected_cell(true);
return false;
} else if (event.which === 13 && event.ctrlKey) {
that.execute_selected_cell(false);
that.selected_cell().clear_input();
return false;
};
});