##// END OF EJS Templates
Making keyboard shortcut for showing line numbers consistent.
Brian Granger -
Show More
@@ -142,6 +142,16 b' 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 155 IPython.Cell = Cell;
146 156
147 157 return IPython;
@@ -79,11 +79,11 b' var IPython = (function (IPython) {'
79 79 var that = this;
80 80 // whatever key is pressed, first, cancel the tooltip request before
81 81 // they are sent, and remove tooltip if any
82 if(event.type === 'keydown' ){
82 if(event.type === 'keydown' ) {
83 83 that.remove_and_cancel_tooltip();
84 }
85
86
84 };
85
86
87 87 if (event.keyCode === 13 && (event.shiftKey || event.ctrlKey)) {
88 88 // Always ignore shift-enter in CodeMirror as we handle it.
89 89 return true;
@@ -136,7 +136,7 b' var IPython = (function (IPython) {'
136 136 this.completion_cursor = cur;
137 137 IPython.notebook.complete_cell(this, line, cur.ch);
138 138 return true;
139 }
139 };
140 140 } else if (event.keyCode === 8 && event.type == 'keydown') {
141 141 // If backspace and the line ends with 4 spaces, remove them.
142 142 var cur = editor.getCursor();
@@ -151,13 +151,8 b' var IPython = (function (IPython) {'
151 151 return true;
152 152 } else {
153 153 return false;
154 }
155 } else if (event.keyCode === 76 && event.ctrlKey && event.shiftKey
156 && event.type == 'keydown') {
157 // toggle line numbers with Ctrl-Shift-L
158 this.toggle_line_numbers();
159 }
160 else {
154 };
155 } else {
161 156 // keypress/keyup also trigger on TAB press, and we don't want to
162 157 // use those to disable tab completion.
163 158 if (this.is_completing && event.keyCode !== 9) {
@@ -166,8 +161,8 b' var IPython = (function (IPython) {'
166 161 if (ed_cur.line !== cc_cur.line || ed_cur.ch !== cc_cur.ch) {
167 162 this.is_completing = false;
168 163 this.completion_cursor = null;
169 }
170 }
164 };
165 };
171 166 return false;
172 167 };
173 168 return false;
@@ -549,16 +544,6 b' 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 547 CodeCell.prototype.select = function () {
563 548 IPython.Cell.prototype.select.apply(this);
564 549 this.code_mirror.refresh();
General Comments 0
You need to be logged in to leave comments. Login now