@@ -372,8 +372,8 @@ function initTogetherJS() {
372372 }
373373
374374 if ( msg . codeInputScrollTop !== undefined ) {
375- // give pyInputCodeMirror a bit of time to settle with its new
376- // value. this is hacky; ideally we have a callback function for
375+ // give pyInputCodeMirror/pyInputAceEditor a bit of time to settle with
376+ // its new value. this is hacky; ideally we have a callback function for
377377 // when setValue() completes.
378378 $ . doTimeout ( 'pyInputCodeMirrorInit' , 200 , function ( ) {
379379 pyInputSetScrollTop ( msg . codeInputScrollTop ) ;
@@ -1055,16 +1055,25 @@ function handleUncaughtExceptionFunc(trace) {
10551055 if ( trace . length == 1 && trace [ 0 ] . line ) {
10561056 var errorLineNo = trace [ 0 ] . line - 1 ; /* CodeMirror lines are zero-indexed */
10571057 if ( errorLineNo !== undefined && errorLineNo != NaN ) {
1058- // highlight the faulting line in pyInputCodeMirror
1059- pyInputCodeMirror . focus ( ) ;
1060- pyInputCodeMirror . setCursor ( errorLineNo , 0 ) ;
1061- pyInputCodeMirror . addLineClass ( errorLineNo , null , 'errorLine' ) ;
1062-
1063- function f ( ) {
1064- pyInputCodeMirror . removeLineClass ( errorLineNo , null , 'errorLine' ) ; // reset line back to normal
1065- pyInputCodeMirror . off ( 'change' , f ) ;
1058+ // highlight the faulting line
1059+ if ( useCodeMirror ) {
1060+ pyInputCodeMirror . focus ( ) ;
1061+ pyInputCodeMirror . setCursor ( errorLineNo , 0 ) ;
1062+ pyInputCodeMirror . addLineClass ( errorLineNo , null , 'errorLine' ) ;
1063+
1064+ function f ( ) {
1065+ pyInputCodeMirror . removeLineClass ( errorLineNo , null , 'errorLine' ) ; // reset line back to normal
1066+ pyInputCodeMirror . off ( 'change' , f ) ;
1067+ }
1068+ pyInputCodeMirror . on ( 'change' , f ) ;
1069+ }
1070+ else {
1071+ var s = pyInputAceEditor . getSession ( ) ;
1072+ s . setAnnotations ( [ { row : errorLineNo ,
1073+ type : 'error' ,
1074+ text : trace [ 0 ] . exception_msg } ] ) ;
1075+ pyInputAceEditor . gotoLine ( errorLineNo + 1 /* one-indexed */ ) ;
10661076 }
1067- pyInputCodeMirror . on ( 'change' , f ) ;
10681077 }
10691078 }
10701079}
0 commit comments