##// END OF EJS Templates
Merge pull request #4916 from ellisonbg/modalbehavior...
Min RK -
r14962:3e91d885 merge
parent child Browse files
Show More
@@ -88,18 +88,18 b' var IPython = (function (IPython) {'
88 }
88 }
89 },
89 },
90 'shift+enter' : {
90 'shift+enter' : {
91 help : 'run cell',
91 help : 'run cell, select below',
92 help_index : 'ba',
92 help_index : 'ba',
93 handler : function (event) {
93 handler : function (event) {
94 IPython.notebook.execute_cell();
94 IPython.notebook.execute_cell_and_select_below();
95 return false;
95 return false;
96 }
96 }
97 },
97 },
98 'ctrl+enter' : {
98 'ctrl+enter' : {
99 help : 'run cell, select below',
99 help : 'run cell',
100 help_index : 'bb',
100 help_index : 'bb',
101 handler : function (event) {
101 handler : function (event) {
102 IPython.notebook.execute_cell_and_select_below();
102 IPython.notebook.execute_cell();
103 return false;
103 return false;
104 }
104 }
105 },
105 },
@@ -847,7 +847,6 b' var IPython = (function (IPython) {'
847 target_cell.code_mirror.clearHistory();
847 target_cell.code_mirror.clearHistory();
848 source_element.remove();
848 source_element.remove();
849 this.select(i);
849 this.select(i);
850 this.edit_mode();
851 this.set_dirty(true);
850 this.set_dirty(true);
852 };
851 };
853 };
852 };
@@ -878,7 +877,9 b' var IPython = (function (IPython) {'
878 target_cell.code_mirror.clearHistory();
877 target_cell.code_mirror.clearHistory();
879 source_element.remove();
878 source_element.remove();
880 this.select(i);
879 this.select(i);
881 this.edit_mode();
880 if ((source_cell instanceof IPython.TextCell) && source_cell.rendered) {
881 target_cell.render();
882 }
882 this.set_dirty(true);
883 this.set_dirty(true);
883 };
884 };
884 };
885 };
@@ -910,7 +911,6 b' var IPython = (function (IPython) {'
910 target_cell.code_mirror.clearHistory();
911 target_cell.code_mirror.clearHistory();
911 source_element.remove();
912 source_element.remove();
912 this.select(i);
913 this.select(i);
913 this.edit_mode();
914 this.set_dirty(true);
914 this.set_dirty(true);
915 };
915 };
916 };
916 };
@@ -947,8 +947,10 b' var IPython = (function (IPython) {'
947 target_cell.code_mirror.clearHistory();
947 target_cell.code_mirror.clearHistory();
948 source_element.remove();
948 source_element.remove();
949 this.select(i);
949 this.select(i);
950 if ((source_cell instanceof IPython.TextCell) && source_cell.rendered) {
951 target_cell.render();
952 }
950 };
953 };
951 this.edit_mode();
952 this.set_dirty(true);
954 this.set_dirty(true);
953 $([IPython.events]).trigger('selected_cell_type_changed.Notebook',
955 $([IPython.events]).trigger('selected_cell_type_changed.Notebook',
954 {'cell_type':'heading',level:level}
956 {'cell_type':'heading',level:level}
@@ -1441,11 +1443,7 b' var IPython = (function (IPython) {'
1441 return;
1443 return;
1442 }
1444 }
1443
1445
1444 // Only insert a new cell, if we ended up in an already populated cell
1445 var next_text = this.get_cell(cell_index+1).get_text();
1446 if (/\S/.test(next_text) === true) {
1447 this.insert_cell_below('code');
1446 this.insert_cell_below('code');
1448 }
1449 this.select(cell_index+1);
1447 this.select(cell_index+1);
1450 this.edit_mode();
1448 this.edit_mode();
1451 this.set_dirty(true);
1449 this.set_dirty(true);
@@ -22,7 +22,7 b' casper.notebook_test(function () {'
22 var cell = IPython.notebook.get_cell(0);
22 var cell = IPython.notebook.get_cell(0);
23 cell.set_text('a=11; print(a)');
23 cell.set_text('a=11; print(a)');
24 cell.clear_output();
24 cell.clear_output();
25 IPython.utils.press_ctrl_enter();
25 IPython.utils.press_shift_enter();
26 });
26 });
27
27
28 this.wait_for_output(0);
28 this.wait_for_output(0);
@@ -31,7 +31,7 b' casper.notebook_test(function () {'
31 var result = this.get_output_cell(0);
31 var result = this.get_output_cell(0);
32 var num_cells = this.get_cells_length();
32 var num_cells = this.get_cells_length();
33 this.test.assertEquals(result.text, '11\n', 'cell execute (using ctrl-enter)');
33 this.test.assertEquals(result.text, '11\n', 'cell execute (using ctrl-enter)');
34 this.test.assertEquals(num_cells, 2, 'ctrl-enter adds a new cell at the bottom')
34 this.test.assertEquals(num_cells, 2, 'shift-enter adds a new cell at the bottom')
35 });
35 });
36
36
37 // do it again with the keyboard shortcut
37 // do it again with the keyboard shortcut
@@ -41,7 +41,7 b' casper.notebook_test(function () {'
41 var cell = IPython.notebook.get_cell(0);
41 var cell = IPython.notebook.get_cell(0);
42 cell.set_text('a=12; print(a)');
42 cell.set_text('a=12; print(a)');
43 cell.clear_output();
43 cell.clear_output();
44 IPython.utils.press_shift_enter();
44 IPython.utils.press_ctrl_enter();
45 });
45 });
46
46
47 this.wait_for_output(0);
47 this.wait_for_output(0);
@@ -50,7 +50,7 b' casper.notebook_test(function () {'
50 var result = this.get_output_cell(0);
50 var result = this.get_output_cell(0);
51 var num_cells = this.get_cells_length();
51 var num_cells = this.get_cells_length();
52 this.test.assertEquals(result.text, '12\n', 'cell execute (using shift-enter)');
52 this.test.assertEquals(result.text, '12\n', 'cell execute (using shift-enter)');
53 this.test.assertEquals(num_cells, 1, 'shift-enter adds no new cell at the bottom')
53 this.test.assertEquals(num_cells, 1, 'ctrl-enter adds no new cell at the bottom')
54 });
54 });
55
55
56 // press the "play" triangle button in the toolbar
56 // press the "play" triangle button in the toolbar
General Comments 0
You need to be logged in to leave comments. Login now