summaryrefslogtreecommitdiff
path: root/js/codeq
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@araneo.org>2015-09-29 11:10:05 +0200
committerTimotej Lazar <timotej.lazar@araneo.org>2015-09-29 11:10:05 +0200
commit268f24905e4cc488c80f1d057451b6e528e3ff05 (patch)
tree476387a5817bbba596fbedb57f5bc3cdf140c9aa /js/codeq
parent10de7241f22a10d65f53c891a8b07fe8650b4878 (diff)
Convert tab to 4 spaces in Python codemirror
Diffstat (limited to 'js/codeq')
-rw-r--r--js/codeq/python.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/js/codeq/python.js b/js/codeq/python.js
index cf2199a..c58d7e6 100644
--- a/js/codeq/python.js
+++ b/js/codeq/python.js
@@ -217,7 +217,20 @@
jqEditor = jqCode.find('.code_editor'),
jqTerminal = jqConsole.find('.console'),
jqHints = jqInfo.find('.hints'),
- editor = CodeMirror(jqEditor[0], { cursorHeight: 0.85, lineNumbers: true, matchBrackets: true, mode: 'python' }),
+ editor = CodeMirror(jqEditor[0], {
+ cursorHeight: 0.85,
+ lineNumbers: true,
+ matchBrackets: true,
+ mode: 'python',
+ indentUnit: 4,
+ extraKeys: {
+ // replace tabs with spaces
+ Tab: function (cm) {
+ var spaces = Array(cm.getOption("indentUnit") + 1).join(" ");
+ cm.replaceSelection(spaces);
+ }
+ }
+ }),
activityHandler = makeActivityHandler(editor, problemDef.id),
terminal = makePythonTerminalHandler(jqTerminal, editor, problemDef.id, activityHandler),
hinter = codeq.makeHinter(jqHints, jqEditor, editor, 'python_hints', problemDef.hint, commonHints, problemDef.plan),