@@ -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,7 @@ 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 ,
54
57
'ctrl-enter' : execute_action ,
55
58
'ctrl-b' : toggle_action ,
56
59
}
@@ -94,14 +97,22 @@ define(function (require, exports, module) {
94
97
this . cell . element . hide ( ) ;
95
98
} ;
96
99
97
- Scratchpad . prototype . execute_event = function ( evt ) {
100
+ Scratchpad . prototype . execute_and_select_event = function ( evt ) {
98
101
if ( utils . is_focused ( this . element ) ) {
99
102
this . cell . execute ( ) ;
100
103
} else {
101
104
this . notebook . execute_cell_and_select_below ( ) ;
102
105
}
103
106
} ;
104
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_cell ( ) ;
113
+ }
114
+ } ;
115
+
105
116
function setup_scratchpad ( ) {
106
117
// lazy, hook it up to Jupyter.notebook as the handle on all the singletons
107
118
console . log ( "Setting up scratchpad" ) ;
0 commit comments