##// END OF EJS Templates
Delete cell only if you press "d" twice in 1 second.
Brian E. Granger -
Show More
@@ -17,6 +17,7 b' var IPython = (function (IPython) {'
17 var KeyboardManager = function () {
17 var KeyboardManager = function () {
18 this.mode = 'command';
18 this.mode = 'command';
19 this.enabled = true;
19 this.enabled = true;
20 this.delete_count = 0;
20 this.bind_events();
21 this.bind_events();
21 };
22 };
22
23
@@ -109,6 +110,7 b' var IPython = (function (IPython) {'
109 }
110 }
110
111
111 KeyboardManager.prototype.handle_command_mode = function (event) {
112 KeyboardManager.prototype.handle_command_mode = function (event) {
113 var that = this;
112 var notebook = IPython.notebook;
114 var notebook = IPython.notebook;
113
115
114 if (event.which === key.ENTER && !(event.ctrlKey || event.altKey || event.shiftKey)) {
116 if (event.which === key.ENTER && !(event.ctrlKey || event.altKey || event.shiftKey)) {
@@ -145,7 +147,16 b' var IPython = (function (IPython) {'
145 return false;
147 return false;
146 } else if (event.which === 68) {
148 } else if (event.which === 68) {
147 // Delete selected cell = d
149 // Delete selected cell = d
150 var dc = this.delete_count;
151 console.log('delete_count', dc);
152 if (dc === 0) {
153 this.delete_count = 1;
154 setTimeout(function () {
155 that.delete_count = 0;
156 }, 1000);
157 } else if (dc === 1) {
148 notebook.delete_cell();
158 notebook.delete_cell();
159 }
149 return false;
160 return false;
150 } else if (event.which === 65) {
161 } else if (event.which === 65) {
151 // Insert code cell above selected = a
162 // Insert code cell above selected = a
General Comments 0
You need to be logged in to leave comments. Login now