From 02339c6f6154174bbab19e4b55cce9fe8b22e491 2012-07-27 20:38:56 From: Matthias BUSSONNIER Date: 2012-07-27 20:38:56 Subject: [PATCH] select correct behavior for backspace in codecell --- diff --git a/IPython/frontend/html/notebook/static/js/codecell.js b/IPython/frontend/html/notebook/static/js/codecell.js index 5634429..1347fe1 100644 --- a/IPython/frontend/html/notebook/static/js/codecell.js +++ b/IPython/frontend/html/notebook/static/js/codecell.js @@ -41,7 +41,7 @@ var IPython = (function (IPython) { mode: 'python', theme: 'ipython', readOnly: this.read_only, - extraKeys: {"Tab": "indentMore","Shift-Tab" : "indentLess"}, + extraKeys: {"Tab": "indentMore","Shift-Tab" : "indentLess",'Backspace':"delSpaceToPrevTabStop"}, onKeyEvent: $.proxy(this.handle_codemirror_keyevent,this) }); input.append(input_area); @@ -125,20 +125,6 @@ var IPython = (function (IPython) { this.completer.startCompletion(); return true; }; - } else if (event.keyCode === key.BACKSPACE && event.type == 'keydown') { - // If backspace and the line ends with 4 spaces, remove them. - var line = editor.getLine(cur.line); - var ending = line.slice(-4); - if (ending === ' ') { - editor.replaceRange('', - {line: cur.line, ch: cur.ch-4}, - {line: cur.line, ch: cur.ch} - ); - event.stop(); - return true; - } else { - return false; - }; } else { // keypress/keyup also trigger on TAB press, and we don't want to // use those to disable tab completion.