##// END OF EJS Templates
monkey patch codemirror with new functionality...
Matthias BUSSONNIER -
Show More
@@ -15,6 +15,32 b''
15 * @submodule CodeCell
15 * @submodule CodeCell
16 */
16 */
17
17
18
19 /* local util for codemirror */
20 var posEq = function(a, b) {return a.line == b.line && a.ch == b.ch;}
21
22 /**
23 *
24 * function to delete until previous non blanking space character
25 * or first multiple of 4 tabstop.
26 * @private
27 */
28 CodeMirror.commands.delSpaceToPrevTabStop = function(cm){
29 var from = cm.getCursor(true), to = cm.getCursor(false), sel = !posEq(from, to);
30 if (!posEq(from, to)) {cm.replaceRange("", from, to); return}
31 var cur = cm.getCursor(), line = cm.getLine(cur.line);
32 var tabsize = cm.getOption('tabSize');
33 var chToPrevTabStop = cur.ch-(Math.ceil(cur.ch/tabsize)-1)*tabsize;
34 var from = {ch:cur.ch-chToPrevTabStop,line:cur.line}
35 var select = cm.getRange(from,cur)
36 if( select.match(/^\ +$/) != null){
37 cm.replaceRange("",from,cur)
38 } else {
39 cm.deleteH(-1,"char")
40 }
41 };
42
43
18 var IPython = (function (IPython) {
44 var IPython = (function (IPython) {
19 "use strict";
45 "use strict";
20
46
General Comments 0
You need to be logged in to leave comments. Login now