##// END OF EJS Templates
Making keyboard shortcut for showing line numbers consistent.
Brian Granger -
Show More
@@ -142,6 +142,16 var IPython = (function (IPython) {
142 };
142 };
143
143
144
144
145 Cell.prototype.toggle_line_numbers = function () {
146 if (this.code_mirror.getOption('lineNumbers') == false) {
147 this.code_mirror.setOption('lineNumbers', true);
148 } else {
149 this.code_mirror.setOption('lineNumbers', false);
150 }
151 this.code_mirror.refresh();
152 };
153
154
145 IPython.Cell = Cell;
155 IPython.Cell = Cell;
146
156
147 return IPython;
157 return IPython;
@@ -81,7 +81,7 var IPython = (function (IPython) {
81 // they are sent, and remove tooltip if any
81 // they are sent, and remove tooltip if any
82 if(event.type === 'keydown' ){
82 if(event.type === 'keydown' ) {
83 that.remove_and_cancel_tooltip();
83 that.remove_and_cancel_tooltip();
84 }
84 };
85
85
86
86
87 if (event.keyCode === 13 && (event.shiftKey || event.ctrlKey)) {
87 if (event.keyCode === 13 && (event.shiftKey || event.ctrlKey)) {
@@ -136,7 +136,7 var IPython = (function (IPython) {
136 this.completion_cursor = cur;
136 this.completion_cursor = cur;
137 IPython.notebook.complete_cell(this, line, cur.ch);
137 IPython.notebook.complete_cell(this, line, cur.ch);
138 return true;
138 return true;
139 }
139 };
140 } else if (event.keyCode === 8 && event.type == 'keydown') {
140 } else if (event.keyCode === 8 && event.type == 'keydown') {
141 // If backspace and the line ends with 4 spaces, remove them.
141 // If backspace and the line ends with 4 spaces, remove them.
142 var cur = editor.getCursor();
142 var cur = editor.getCursor();
@@ -151,13 +151,8 var IPython = (function (IPython) {
151 return true;
151 return true;
152 } else {
152 } else {
153 return false;
153 return false;
154 }
154 };
155 } else if (event.keyCode === 76 && event.ctrlKey && event.shiftKey
155 } else {
156 && event.type == 'keydown') {
157 // toggle line numbers with Ctrl-Shift-L
158 this.toggle_line_numbers();
159 }
160 else {
161 // keypress/keyup also trigger on TAB press, and we don't want to
156 // keypress/keyup also trigger on TAB press, and we don't want to
162 // use those to disable tab completion.
157 // use those to disable tab completion.
163 if (this.is_completing && event.keyCode !== 9) {
158 if (this.is_completing && event.keyCode !== 9) {
@@ -166,8 +161,8 var IPython = (function (IPython) {
166 if (ed_cur.line !== cc_cur.line || ed_cur.ch !== cc_cur.ch) {
161 if (ed_cur.line !== cc_cur.line || ed_cur.ch !== cc_cur.ch) {
167 this.is_completing = false;
162 this.is_completing = false;
168 this.completion_cursor = null;
163 this.completion_cursor = null;
169 }
164 };
170 }
165 };
171 return false;
166 return false;
172 };
167 };
173 return false;
168 return false;
@@ -549,16 +544,6 var IPython = (function (IPython) {
549 };
544 };
550
545
551
546
552 CodeCell.prototype.toggle_line_numbers = function () {
553 if (this.code_mirror.getOption('lineNumbers') == false) {
554 this.code_mirror.setOption('lineNumbers', true);
555 } else {
556 this.code_mirror.setOption('lineNumbers', false);
557 }
558 this.code_mirror.refresh();
559 };
560
561
562 CodeCell.prototype.select = function () {
547 CodeCell.prototype.select = function () {
563 IPython.Cell.prototype.select.apply(this);
548 IPython.Cell.prototype.select.apply(this);
564 this.code_mirror.refresh();
549 this.code_mirror.refresh();
General Comments 0
You need to be logged in to leave comments. Login now