##// END OF EJS Templates
Refactor line num. toggle into proper function, access via C-m-l....
Fernando Perez -
Show More
@@ -90,12 +90,7 b' var IPython = (function (IPython) {'
90 90 } else if (event.keyCode === 76 && event.ctrlKey && event.shiftKey
91 91 && event.type == 'keydown') {
92 92 // toggle line numbers with Ctrl-Shift-L
93 if (this.code_mirror.getOption('lineNumbers') == false) {
94 this.code_mirror.setOption('lineNumbers', true);
95 } else {
96 this.code_mirror.setOption('lineNumbers', false);
97 }
98 this.code_mirror.refresh()
93 this.toggle_line_numbers()
99 94 }
100 95 else {
101 96 // keypress/keyup also trigger on TAB press, and we don't want to
@@ -188,6 +183,14 b' var IPython = (function (IPython) {'
188 183 select.focus();
189 184 };
190 185
186 CodeCell.prototype.toggle_line_numbers = function () {
187 if (this.code_mirror.getOption('lineNumbers') == false) {
188 this.code_mirror.setOption('lineNumbers', true);
189 } else {
190 this.code_mirror.setOption('lineNumbers', false);
191 }
192 this.code_mirror.refresh()
193 };
191 194
192 195 CodeCell.prototype.select = function () {
193 196 IPython.Cell.prototype.select.apply(this);
@@ -140,6 +140,11 b' var IPython = (function (IPython) {'
140 140 IPython.notebook.kernel.interrupt();
141 141 that.control_key_active = false;
142 142 return false;
143 } else if (event.which === 76 && that.control_key_active) {
144 // Toggle line numbers = l
145 that.cell_toggle_line_numbers();
146 that.control_key_active = false;
147 return false;
143 148 } else if (event.which === 190 && that.control_key_active) {
144 149 // Restart kernel = . # matches qt console
145 150 IPython.notebook.restart_kernel();
@@ -195,12 +200,12 b' var IPython = (function (IPython) {'
195 200 var dialog = $('<div/>');
196 201 var shortcuts = [
197 202 {key: 'Shift-Enter', help: 'run cell'},
198 {key: 'Ctrl-Enter', help: 'run cell in terminal mode'},
199 {key: 'Ctrl-Shift-L', help: 'toggle line numbering'},
203 {key: 'Ctrl-Enter', help: 'run cell in-place'},
200 204 {key: 'Ctrl-m d', help: 'delete cell'},
201 205 {key: 'Ctrl-m a', help: 'insert cell above'},
202 206 {key: 'Ctrl-m b', help: 'insert cell below'},
203 207 {key: 'Ctrl-m t', help: 'toggle output'},
208 {key: 'Ctrl-m l', help: 'toggle line numbers'},
204 209 {key: 'Ctrl-m s', help: 'save notebook'},
205 210 {key: 'Ctrl-m j', help: 'move cell down'},
206 211 {key: 'Ctrl-m k', help: 'move cell up'},
@@ -210,7 +215,7 b' var IPython = (function (IPython) {'
210 215 {key: 'Ctrl-m n', help: 'select next'},
211 216 {key: 'Ctrl-m i', help: 'interrupt kernel'},
212 217 {key: 'Ctrl-m .', help: 'restart kernel'},
213 {key: 'Ctrl-m h', help: 'display keyboard shortcuts'}
218 {key: 'Ctrl-m h', help: 'show keyboard shortcuts'}
214 219 ];
215 220 for (var i=0; i<shortcuts.length; i++) {
216 221 dialog.append($('<div>').
@@ -615,6 +620,11 b' var IPython = (function (IPython) {'
615 620 this.dirty = true;
616 621 };
617 622
623 // Other cell functions: line numbers, ...
624
625 Notebook.prototype.cell_toggle_line_numbers = function() {
626 this.selected_cell().toggle_line_numbers()
627 };
618 628
619 629 // Kernel related things
620 630
@@ -176,7 +176,7 b''
176 176 <div class="section_content">
177 177 <div class="section_row">
178 178 <span id="int_restart" class="section_row_buttons">
179 <button id="int_kernel">Interrupt</button>
179 <button id="int_kernel"><u>I</u>nterrupt</button>
180 180 <button id="restart_kernel">Restart</button>
181 181 </span>
182 182 <span class="section_row_header">Actions</span>
@@ -217,7 +217,7 b''
217 217 <span class="help_string_label">Shift-Enter :</span>
218 218 </div>
219 219 <div class="section_row">
220 <span class="help_string">run in terminal mode</span>
220 <span class="help_string">run selected cell in-place</span>
221 221 <span class="help_string_label">Ctrl-Enter :</span>
222 222 </div>
223 223 <div class="section_row">
General Comments 0
You need to be logged in to leave comments. Login now