@@ -223,9 +223,15 @@ SyntaxErrorSurveyBubble.prototype.qTipID = function() {
223223
224224// created on 2015-04-18
225225function experimentalPopUpSyntaxErrorSurvey ( ) {
226- if ( prevExecutionExceptionObj &&
227- prevExecutionExceptionObj . killerException . line !== undefined ) {
226+ if ( prevExecutionExceptionObjLst . length > 0 ) {
227+ // work with the most recent entry
228+ var prevExecutionExceptionObj = prevExecutionExceptionObjLst [ prevExecutionExceptionObjLst . length - 1 ] ;
228229 var offendingLine = prevExecutionExceptionObj . killerException . line ;
230+
231+ if ( offendingLine === undefined ) {
232+ return ; // get out early!
233+ }
234+
229235 // make sure jquery.qtip has been imported
230236
231237 var codelineIDs = [ ] ;
@@ -242,7 +248,6 @@ function experimentalPopUpSyntaxErrorSurvey() {
242248 // because the code changed so much that the line number in question
243249 // is no longer available
244250 if ( codelineIDs . length === 1 ) {
245- console . log ( 'PREV' , prevExecutionExceptionObj ) ;
246251 var codLineId = codelineIDs [ 0 ] ;
247252
248253 var bub = new SyntaxErrorSurveyBubble ( myVisualizer , codLineId ) ;
@@ -256,7 +261,7 @@ function experimentalPopUpSyntaxErrorSurvey() {
256261 my : bub . my ,
257262 at : bub . at ,
258263 adjust : {
259- x : - 10 ,
264+ x : - 6 ,
260265 } ,
261266 effect : null , // disable all cutesy animations
262267 } ,
@@ -269,10 +274,10 @@ function experimentalPopUpSyntaxErrorSurvey() {
269274 $ ( bub . qTipID ( ) ) . css ( 'max-width' , '350px' ) . width ( '350px' ) ;
270275
271276 $ ( bub . qTipContentID ( ) ) . html ( '<div id="syntaxErrBubbleContents"><div id="syntaxErrHeader">You just fixed the following error:</div>\
272- <div id="syntaxErrMsg">[ERROR MSG]</div>\
273277 <div id="syntaxErrCodeDisplay"></div>\
278+ <div id="syntaxErrMsg"></div>\
274279 <div id="syntaxErrQuestion">\
275- What would have been a better error message here?<br/>\
280+ If you think this message wasn\'t helpful, what would have been the ideal error message for you here?<br/>\
276281 <input type="text" id="syntaxErrTxtInput" size=60 maxlength=150/><br/>\
277282 <button class="syntaxErrSubmitBtn" type="button">Submit</button>\
278283 <button class="syntaxErrCloseBtn" type="button">Cancel</button>\
@@ -287,6 +292,10 @@ function experimentalPopUpSyntaxErrorSurvey() {
287292
288293
289294 var bubbleAceEditor = ace . edit ( 'syntaxErrCodeDisplay' ) ;
295+ // set the size and value ASAP to get alignment working well ...
296+ bubbleAceEditor . setOptions ( { minLines : 1 , maxLines : 5 } ) ; // keep this SMALL
297+ bubbleAceEditor . setValue ( prevExecutionExceptionObj . myAppState . code . rtrim ( ) /* kill trailing spaces */ ,
298+ - 1 /* do NOT select after setting text */ ) ;
290299
291300 var s = bubbleAceEditor . getSession ( ) ;
292301 // tab -> 4 spaces
@@ -300,10 +309,9 @@ function experimentalPopUpSyntaxErrorSurvey() {
300309
301310 bubbleAceEditor . setFontSize ( 10 ) ;
302311
303- bubbleAceEditor . setOptions ( { minLines : 5 , maxLines : 5 } ) ; // keep this SMALL
304312
305313 $ ( '#syntaxErrCodeDisplay' ) . css ( 'width' , '320px' ) ;
306- $ ( '#syntaxErrCodeDisplay' ) . css ( 'height' , '200px ' ) ; // VERY IMPORTANT so that it works on I.E., ugh!
314+ $ ( '#syntaxErrCodeDisplay' ) . css ( 'height' , '90px ' ) ; // VERY IMPORTANT so that it works on I.E., ugh!
307315
308316 // don't do real-time syntax checks:
309317 // https://github.com/ajaxorg/ace/wiki/Syntax-validation
@@ -320,8 +328,6 @@ function experimentalPopUpSyntaxErrorSurvey() {
320328 }
321329 s . setMode ( "ace/mode/" + mod ) ;
322330
323- bubbleAceEditor . setValue ( prevExecutionExceptionObj . myAppState . code . rtrim ( ) /* kill trailing spaces */ ,
324- - 1 /* do NOT select after setting text */ ) ;
325331 bubbleAceEditor . setReadOnly ( true ) ;
326332
327333 s . setAnnotations ( [ { row : offendingLine - 1 /* zero-indexed */ ,
@@ -338,8 +344,9 @@ function experimentalPopUpSyntaxErrorSurvey() {
338344 // don't forget htmlspecialchars
339345 $ ( "#syntaxErrMsg" ) . html ( htmlspecialchars ( prevExecutionExceptionObj . killerException . exception_msg ) ) ;
340346
341- // TODO: why is this positioning so wonky in the beginning?!?
342347 bub . redrawCodelineBubble ( ) ; // do an initial redraw to align everything
348+
349+ //globalBub = bub; // for debugging
343350 }
344351 }
345352}
0 commit comments