fixed codemirror syntax highlighting, thanks Mariano
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -645,6 +645,7 @@ def edit():
|
|||||||
code = request.vars.data.rstrip().replace('\r\n', '\n') + '\n'
|
code = request.vars.data.rstrip().replace('\r\n', '\n') + '\n'
|
||||||
compile(code, path, "exec", _ast.PyCF_ONLY_AST)
|
compile(code, path, "exec", _ast.PyCF_ONLY_AST)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
|
# offset calculation is only used for textarea (start/stop)
|
||||||
start = sum([len(line) + 1 for l, line
|
start = sum([len(line) + 1 for l, line
|
||||||
in enumerate(request.vars.data.split("\n"))
|
in enumerate(request.vars.data.split("\n"))
|
||||||
if l < e.lineno - 1])
|
if l < e.lineno - 1])
|
||||||
@@ -654,7 +655,7 @@ def edit():
|
|||||||
else:
|
else:
|
||||||
offset = 0
|
offset = 0
|
||||||
highlight = {'start': start, 'end': start +
|
highlight = {'start': start, 'end': start +
|
||||||
offset + 1, 'lineno': e.lineno}
|
offset + 1, 'lineno': e.lineno, 'offset': offset}
|
||||||
try:
|
try:
|
||||||
ex_name = e.__class__.__name__
|
ex_name = e.__class__.__name__
|
||||||
except:
|
except:
|
||||||
|
|||||||
@@ -43,8 +43,9 @@ function doHighlight(highlight) {
|
|||||||
if (window.ace_editor) {
|
if (window.ace_editor) {
|
||||||
window.ace_editor.gotoLine(highlight.lineno);
|
window.ace_editor.gotoLine(highlight.lineno);
|
||||||
} else if (window.mirror) {
|
} else if (window.mirror) {
|
||||||
window.mirror.setSelection({line:highlight.lineno,ch:0},
|
// Put the cursor at the offending line:
|
||||||
{line:highlight.end,ch:0});
|
window.mirror.setCursor({line:highlight.lineno-1,
|
||||||
|
ch:highlight.offset+1});
|
||||||
} else if (window.eamy) {
|
} else if (window.eamy) {
|
||||||
// not implemented
|
// not implemented
|
||||||
} else if (window.textarea) {
|
} else if (window.textarea) {
|
||||||
|
|||||||
Reference in New Issue
Block a user