fixed codemirror syntax highlighting, thanks Mariano

This commit is contained in:
mdipierro
2013-01-27 09:59:19 -06:00
parent ec7c8f0248
commit 8fe3934c6e
3 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.4.1-alpha.2+timestamp.2013.01.27.09.45.36
Version 2.4.1-alpha.2+timestamp.2013.01.27.09.58.34
+2 -1
View File
@@ -645,6 +645,7 @@ def edit():
code = request.vars.data.rstrip().replace('\r\n', '\n') + '\n'
compile(code, path, "exec", _ast.PyCF_ONLY_AST)
except Exception, e:
# offset calculation is only used for textarea (start/stop)
start = sum([len(line) + 1 for l, line
in enumerate(request.vars.data.split("\n"))
if l < e.lineno - 1])
@@ -654,7 +655,7 @@ def edit():
else:
offset = 0
highlight = {'start': start, 'end': start +
offset + 1, 'lineno': e.lineno}
offset + 1, 'lineno': e.lineno, 'offset': offset}
try:
ex_name = e.__class__.__name__
except:
+3 -2
View File
@@ -43,8 +43,9 @@ function doHighlight(highlight) {
if (window.ace_editor) {
window.ace_editor.gotoLine(highlight.lineno);
} else if (window.mirror) {
window.mirror.setSelection({line:highlight.lineno,ch:0},
{line:highlight.end,ch:0});
// Put the cursor at the offending line:
window.mirror.setCursor({line:highlight.lineno-1,
ch:highlight.offset+1});
} else if (window.eamy) {
// not implemented
} else if (window.textarea) {