File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -102,26 +102,6 @@ $(document).ready(function() {
102102 compactFuncLabels : true ,
103103 }
104104
105- function handleUncaughtExceptionFunc ( trace ) {
106- if ( trace . length == 1 ) {
107- var errorLineNo = trace [ 0 ] . line - 1 ; /* CodeMirror lines are zero-indexed */
108- if ( errorLineNo !== undefined ) {
109- // highlight the faulting line in pyInputCodeMirror
110- pyInputCodeMirror . focus ( ) ;
111- pyInputCodeMirror . setCursor ( errorLineNo , 0 ) ;
112- pyInputCodeMirror . setLineClass ( errorLineNo , null , 'errorLine' ) ;
113-
114- pyInputCodeMirror . setOption ( 'onChange' , function ( ) {
115- pyInputCodeMirror . setLineClass ( errorLineNo , null , null ) ; // reset line back to normal
116- pyInputCodeMirror . setOption ( 'onChange' , null ) ; // cancel
117- } ) ;
118- }
119-
120- $ ( '#executeBtn' ) . html ( "Visualize Execution" ) ;
121- $ ( '#executeBtn' ) . attr ( 'disabled' , false ) ;
122- }
123- }
124-
125105 executePythonCode ( pyInputCodeMirror . getValue ( ) ,
126106 backend_script , backendOptionsObj ,
127107 frontendOptionsObj ,
Original file line number Diff line number Diff line change @@ -105,26 +105,6 @@ $(document).ready(function() {
105105 updateOutputCallback : function ( ) { $ ( '#urlOutput,#embedCodeOutput' ) . val ( '' ) ; } ,
106106 }
107107
108- function handleUncaughtExceptionFunc ( trace ) {
109- if ( trace . length == 1 ) {
110- var errorLineNo = trace [ 0 ] . line - 1 ; /* CodeMirror lines are zero-indexed */
111- if ( errorLineNo !== undefined ) {
112- // highlight the faulting line in pyInputCodeMirror
113- pyInputCodeMirror . focus ( ) ;
114- pyInputCodeMirror . setCursor ( errorLineNo , 0 ) ;
115- pyInputCodeMirror . setLineClass ( errorLineNo , null , 'errorLine' ) ;
116-
117- pyInputCodeMirror . setOption ( 'onChange' , function ( ) {
118- pyInputCodeMirror . setLineClass ( errorLineNo , null , null ) ; // reset line back to normal
119- pyInputCodeMirror . setOption ( 'onChange' , null ) ; // cancel
120- } ) ;
121- }
122-
123- $ ( '#executeBtn' ) . html ( "Visualize Execution" ) ;
124- $ ( '#executeBtn' ) . attr ( 'disabled' , false ) ;
125- }
126- }
127-
128108 executePythonCode ( pyInputCodeMirror . getValue ( ) ,
129109 backend_script , backendOptionsObj ,
130110 frontendOptionsObj ,
Original file line number Diff line number Diff line change @@ -167,6 +167,7 @@ $(document).ready(function() {
167167 // highlight the faulting line in pyInputCodeMirror
168168 pyInputCodeMirror . focus ( ) ;
169169 pyInputCodeMirror . setCursor ( errorLineNo , 0 ) ;
170+ // TODO: refactor to use new CodeMirror version
170171 pyInputCodeMirror . setLineClass ( errorLineNo , null , 'errorLine' ) ;
171172
172173 pyInputCodeMirror . setOption ( 'onChange' , function ( ) {
@@ -178,6 +179,7 @@ $(document).ready(function() {
178179 // instead highlight the faulting line in pyTestInputCodeMirror
179180 errorLineNo -= nCodeLines ;
180181
182+ // TODO: refactor to use new CodeMirror version
181183 pyTestInputCodeMirror . focus ( ) ;
182184 pyTestInputCodeMirror . setCursor ( errorLineNo , 0 ) ;
183185 pyTestInputCodeMirror . setLineClass ( errorLineNo , null , 'errorLine' ) ;
Original file line number Diff line number Diff line change @@ -198,6 +198,28 @@ function updateAppDisplay() {
198198}
199199
200200
201+ function handleUncaughtExceptionFunc ( trace ) {
202+ if ( trace . length == 1 && trace [ 0 ] . line ) {
203+ var errorLineNo = trace [ 0 ] . line - 1 ; /* CodeMirror lines are zero-indexed */
204+ if ( errorLineNo !== undefined && errorLineNo != NaN ) {
205+ // highlight the faulting line in pyInputCodeMirror
206+ pyInputCodeMirror . focus ( ) ;
207+ pyInputCodeMirror . setCursor ( errorLineNo , 0 ) ;
208+ pyInputCodeMirror . addLineClass ( errorLineNo , null , 'errorLine' ) ;
209+
210+ function f ( ) {
211+ pyInputCodeMirror . removeLineClass ( errorLineNo , null , 'errorLine' ) ; // reset line back to normal
212+ pyInputCodeMirror . off ( 'change' , f ) ;
213+ }
214+ pyInputCodeMirror . on ( 'change' , f ) ;
215+ }
216+
217+ $ ( '#executeBtn' ) . html ( "Visualize Execution" ) ;
218+ $ ( '#executeBtn' ) . attr ( 'disabled' , false ) ;
219+ }
220+ }
221+
222+
201223function enterDisplayMode ( ) {
202224 $ ( document ) . scrollTop ( 0 ) ; // scroll to top to make UX better on small monitors
203225 $ . bbq . pushState ( { mode : 'display' } , 2 /* completely override other hash strings to keep URL clean */ ) ;
Original file line number Diff line number Diff line change @@ -333,26 +333,6 @@ function executeCode(forceStartingInstr) {
333333 holisticMode : ( $ ( '#cumulativeModeSelector' ) . val ( ) == 'holistic' )
334334 }
335335
336- function handleUncaughtExceptionFunc ( trace ) {
337- if ( trace . length == 1 && trace [ 0 ] . line ) {
338- var errorLineNo = trace [ 0 ] . line - 1 ; /* CodeMirror lines are zero-indexed */
339- if ( errorLineNo !== undefined && errorLineNo != NaN ) {
340- // highlight the faulting line in pyInputCodeMirror
341- pyInputCodeMirror . focus ( ) ;
342- pyInputCodeMirror . setCursor ( errorLineNo , 0 ) ;
343- pyInputCodeMirror . setLineClass ( errorLineNo , null , 'errorLine' ) ;
344-
345- pyInputCodeMirror . setOption ( 'onChange' , function ( ) {
346- pyInputCodeMirror . setLineClass ( errorLineNo , null , null ) ; // reset line back to normal
347- pyInputCodeMirror . setOption ( 'onChange' , null ) ; // cancel
348- } ) ;
349- }
350-
351- $ ( '#executeBtn' ) . html ( "Visualize Execution" ) ;
352- $ ( '#executeBtn' ) . attr ( 'disabled' , false ) ;
353- }
354- }
355-
356336 executePythonCode ( pyInputCodeMirror . getValue ( ) ,
357337 backend_script , backendOptionsObj ,
358338 frontendOptionsObj ,
You can’t perform that action at this time.
0 commit comments