@@ -41,7 +41,10 @@ define(function (require, exports, module) {
41
41
cell . refresh ( ) ;
42
42
this . collapse ( ) ;
43
43
44
- // override shift-enter to execute me if I'm focused instead of the notebook's cell
44
+ // override ctrl/shift-enter to execute me if I'm focused instead of the notebook's cell
45
+ var execute_and_select_action = this . km . actions . register ( {
46
+ handler : $ . proxy ( this . execute_and_select_event , this ) ,
47
+ } , 'scratchpad-execute-and-select' ) ;
45
48
var execute_action = this . km . actions . register ( {
46
49
handler : $ . proxy ( this . execute_event , this ) ,
47
50
} , 'scratchpad-execute' ) ;
@@ -50,7 +53,8 @@ define(function (require, exports, module) {
50
53
} , 'scratchpad-toggle' ) ;
51
54
52
55
var shortcuts = {
53
- 'shift-enter' : execute_action ,
56
+ 'shift-enter' : execute_and_select_action ,
57
+ 'ctrl-enter' : execute_action ,
54
58
'ctrl-b' : toggle_action ,
55
59
}
56
60
this . km . edit_shortcuts . add_shortcuts ( shortcuts ) ;
@@ -93,14 +97,22 @@ define(function (require, exports, module) {
93
97
this . cell . element . hide ( ) ;
94
98
} ;
95
99
96
- Scratchpad . prototype . execute_event = function ( evt ) {
100
+ Scratchpad . prototype . execute_and_select_event = function ( evt ) {
97
101
if ( utils . is_focused ( this . element ) ) {
98
102
this . cell . execute ( ) ;
99
103
} else {
100
104
this . notebook . execute_cell_and_select_below ( ) ;
101
105
}
102
106
} ;
103
107
108
+ Scratchpad . prototype . execute_event = function ( evt ) {
109
+ if ( utils . is_focused ( this . element ) ) {
110
+ this . cell . execute ( ) ;
111
+ } else {
112
+ this . notebook . execute_selected_cells ( ) ;
113
+ }
114
+ } ;
115
+
104
116
function setup_scratchpad ( ) {
105
117
// lazy, hook it up to Jupyter.notebook as the handle on all the singletons
106
118
console . log ( "Setting up scratchpad" ) ;
0 commit comments