##// END OF EJS Templates
add ctrlKey.which to utils...
Matthias BUSSONNIER -
Show More
@@ -91,7 +91,7 b' var IPython = (function (IPython) {'
91 };
91 };
92
92
93
93
94 if (event.keyCode === 13 && (event.shiftKey || event.ctrlKey)) {
94 if (event.keyCode === key.enter && (event.shiftKey || event.ctrlKey)) {
95 // Always ignore shift-enter in CodeMirror as we handle it.
95 // Always ignore shift-enter in CodeMirror as we handle it.
96 return true;
96 return true;
97 } else if (event.which === 40 && event.type === 'keypress' && tooltip_wait_time >= 0) {
97 } else if (event.which === 40 && event.type === 'keypress' && tooltip_wait_time >= 0) {
@@ -12,6 +12,7 b''
12 var IPython = (function (IPython) {
12 var IPython = (function (IPython) {
13
13
14 var utils = IPython.utils;
14 var utils = IPython.utils;
15 var key = IPython.utils.keycodes;
15
16
16 var Notebook = function (selector) {
17 var Notebook = function (selector) {
17 this.read_only = IPython.read_only;
18 this.read_only = IPython.read_only;
@@ -73,27 +74,27 b' var IPython = (function (IPython) {'
73 that.save_notebook();
74 that.save_notebook();
74 event.preventDefault();
75 event.preventDefault();
75 return false;
76 return false;
76 } else if (event.which === 27) {
77 } else if (event.which === key.esc) {
77 // Intercept escape at highest level to avoid closing
78 // Intercept escape at highest level to avoid closing
78 // websocket connection with firefox
79 // websocket connection with firefox
79 event.preventDefault();
80 event.preventDefault();
80 }
81 }
81 if (event.which === 38 && !event.shiftKey) {
82 if (event.which === key.upArrow && !event.shiftKey) {
82 var cell = that.get_selected_cell();
83 var cell = that.get_selected_cell();
83 if (cell.at_top()) {
84 if (cell.at_top()) {
84 event.preventDefault();
85 event.preventDefault();
85 that.select_prev();
86 that.select_prev();
86 };
87 };
87 } else if (event.which === 40 && !event.shiftKey) {
88 } else if (event.which === key.downArrow && !event.shiftKey) {
88 var cell = that.get_selected_cell();
89 var cell = that.get_selected_cell();
89 if (cell.at_bottom()) {
90 if (cell.at_bottom()) {
90 event.preventDefault();
91 event.preventDefault();
91 that.select_next();
92 that.select_next();
92 };
93 };
93 } else if (event.which === 13 && event.shiftKey) {
94 } else if (event.which === key.enter && event.shiftKey) {
94 that.execute_selected_cell();
95 that.execute_selected_cell();
95 return false;
96 return false;
96 } else if (event.which === 13 && event.ctrlKey) {
97 } else if (event.which === key.enter && event.ctrlKey) {
97 that.execute_selected_cell({terminal:true});
98 that.execute_selected_cell({terminal:true});
98 return false;
99 return false;
99 } else if (event.which === 77 && event.ctrlKey && that.control_key_active == false) {
100 } else if (event.which === 77 && event.ctrlKey && that.control_key_active == false) {
@@ -97,6 +97,8 b' IPython.utils = (function (IPython) {'
97 tab : 9,
97 tab : 9,
98 enter : 13,
98 enter : 13,
99 shift : 16,
99 shift : 16,
100 ctrl : 17,
101 control : 17,
100 esc : 27,
102 esc : 27,
101 space : 32,
103 space : 32,
102 pgUp : 33,
104 pgUp : 33,
General Comments 0
You need to be logged in to leave comments. Login now