##// END OF EJS Templates
Autoindentation fixed and enabled by default.
Brian E. Granger -
Show More
@@ -10,9 +10,10 b' var IPython = (function (IPython) {'
10 var Cell = function (notebook) {
10 var Cell = function (notebook) {
11 this.notebook = notebook;
11 this.notebook = notebook;
12 this.selected = false;
12 this.selected = false;
13 this.element;
13 this.element = null;
14 this.create_element();
14 this.create_element();
15 if (this.element !== undefined) {
15 if (this.element !== null) {
16 this.set_autoindent(true);
16 this.element.data("cell", this);
17 this.element.data("cell", this);
17 this.bind_events();
18 this.bind_events();
18 }
19 }
@@ -27,8 +27,6 b' var IPython = (function (IPython) {'
27 var input_area = $('<div/>').addClass('input_area box-flex1');
27 var input_area = $('<div/>').addClass('input_area box-flex1');
28 this.code_mirror = CodeMirror(input_area.get(0), {
28 this.code_mirror = CodeMirror(input_area.get(0), {
29 indentUnit : 4,
29 indentUnit : 4,
30 enterMode : 'flat',
31 tabMode: 'shift',
32 mode: 'python',
30 mode: 'python',
33 theme: 'ipython',
31 theme: 'ipython',
34 onKeyEvent: $.proxy(this.handle_codemirror_keyevent,this)
32 onKeyEvent: $.proxy(this.handle_codemirror_keyevent,this)
@@ -64,7 +62,8 b' var IPython = (function (IPython) {'
64 IPython.notebook.complete_cell(this, line, cur.ch);
62 IPython.notebook.complete_cell(this, line, cur.ch);
65 return true;
63 return true;
66 }
64 }
67 } else if (event.keyCode === 8) {
65 } else if (event.keyCode === 8 && event.type == 'keydown') {
66 console.log(event);
68 // If backspace and the line ends with 4 spaces, remove them.
67 // If backspace and the line ends with 4 spaces, remove them.
69 var cur = editor.getCursor();
68 var cur = editor.getCursor();
70 var line = editor.getLine(cur.line);
69 var line = editor.getLine(cur.line);
@@ -24,8 +24,6 b' var IPython = (function (IPython) {'
24 var input_area = $('<div/>').addClass('text_cell_input');
24 var input_area = $('<div/>').addClass('text_cell_input');
25 this.code_mirror = CodeMirror(input_area.get(0), {
25 this.code_mirror = CodeMirror(input_area.get(0), {
26 indentUnit : 4,
26 indentUnit : 4,
27 enterMode : 'flat',
28 tabMode: 'shift',
29 mode: this.code_mirror_mode,
27 mode: this.code_mirror_mode,
30 theme: 'default',
28 theme: 'default',
31 value: this.placeholder
29 value: this.placeholder
@@ -121,7 +121,7 b''
121 </div>
121 </div>
122 <div class="section_row">
122 <div class="section_row">
123 <span id="autoindent_span">
123 <span id="autoindent_span">
124 <input type="checkbox" id="autoindent"></input>
124 <input type="checkbox" id="autoindent" checked="true"></input>
125 </span>
125 </span>
126 <span class="checkbox_label">Autoindent:</span>
126 <span class="checkbox_label">Autoindent:</span>
127 </div>
127 </div>
General Comments 0
You need to be logged in to leave comments. Login now