Show More
@@ -578,7 +578,7 var IPython = (function (IPython) { | |||||
578 | }; |
|
578 | }; | |
579 |
|
579 | |||
580 |
|
580 | |||
581 | // Copy/Paste |
|
581 | // Copy/Paste/Merge/Split | |
582 |
|
582 | |||
583 | Notebook.prototype.enable_paste = function () { |
|
583 | Notebook.prototype.enable_paste = function () { | |
584 | var that = this; |
|
584 | var that = this; | |
@@ -663,6 +663,23 var IPython = (function (IPython) { | |||||
663 | }; |
|
663 | }; | |
664 |
|
664 | |||
665 |
|
665 | |||
|
666 | Notebook.prototype.split_cell = function () { | |||
|
667 | var cell = this.selected_cell(); | |||
|
668 | if (cell instanceof IPython.CodeCell) { | |||
|
669 | var cursor = cell.code_mirror.getCursor(); | |||
|
670 | var last_line_num = cell.code_mirror.lineCount()-1; | |||
|
671 | var last_line_len = cell.code_mirror.getLine(last_line_num).length; | |||
|
672 | var end = {line:last_line_num, ch:last_line_len} | |||
|
673 | var texta = cell.code_mirror.getRange({line:0,ch:0}, cursor); | |||
|
674 | var textb = cell.code_mirror.getRange(cursor, end); | |||
|
675 | texta = texta.replace(/^\n+/, '').replace(/\n+$/, ''); | |||
|
676 | textb = textb.replace(/^\n+/, '').replace(/\n+$/, ''); | |||
|
677 | cell.set_code(texta); | |||
|
678 | var new_cell = this.insert_code_cell_below(); | |||
|
679 | new_cell.set_code(textb); | |||
|
680 | }; | |||
|
681 | }; | |||
|
682 | ||||
666 | // Cell collapsing and output clearing |
|
683 | // Cell collapsing and output clearing | |
667 |
|
684 | |||
668 | Notebook.prototype.collapse = function (index) { |
|
685 | Notebook.prototype.collapse = function (index) { |
General Comments 0
You need to be logged in to leave comments.
Login now