reeborg icon indicating copy to clipboard operation
reeborg copied to clipboard

Subtract nb of code lines in Pre to get proper line number information for error messages

Open aroberge opened this issue 1 year ago • 2 comments

When pre code is present, it is concatenated with user code before being run. As a result, the line number shown for errors does not correspond to user code. This should be fixed, but likely only after upgrading to CodeMirror v6.

See also #463

aroberge avatar May 24 '24 13:05 aroberge

Instead of subtracting the line number, it might be more fool-proof to run separately the post code first, then the user code followed by the post-code.

Also, check to see if blank lines at the beginning of Python code are not messing up the line number provided by Brython. It that is the case, perhaps something like

if src.startswith('\n'):
    src = "#" + src

prior to executing the code might do the trick.

aroberge avatar Jul 28 '24 11:07 aroberge

See also #474.

aroberge avatar Jul 28 '24 11:07 aroberge