File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -277,10 +277,13 @@ class AcodePrettier {
277277 endRow -- ;
278278 }
279279
280+ // Ensure endRow is within bounds
281+ endRow = Math . min ( endRow , lines . length - 1 ) ;
282+
280283 // Store the actual selection range for replacement
281284 const selectionRange = {
282285 start : { row : startRow , column : 0 } ,
283- end : { row : endRow , column : lines [ endRow ] . length }
286+ end : { row : endRow , column : lines [ endRow ] ? .length ?? 0 }
284287 } ;
285288
286289 // Extract the selected lines
@@ -407,10 +410,10 @@ class AcodePrettier {
407410</div>` ,
408411 } ) ;
409412 this . #sideButton?. show ( ) ;
410- this . #page. append ( $error ) ;
413+ this . #page. prepend ( $error ) ;
411414
412415 if ( this . #page. childElementCount > 10 ) {
413- this . #page. firstChild . remove ( ) ;
416+ this . #page. lastChild . remove ( ) ;
414417 }
415418
416419 if ( this . prettierOptions . openErrorPageOnErrors ) {
You can’t perform that action at this time.
0 commit comments