@@ -311,37 +311,37 @@ describe('InputHandler', () => {
311311 ) ;
312312
313313 // insert some data in first and second line
314- await inputHandler . parseP ( Array ( bufferService . cols - 9 ) . join ( 'a' ) ) ;
314+ await inputHandler . parseP ( 'a' . repeat ( bufferService . cols - 10 ) ) ;
315315 await inputHandler . parseP ( '1234567890' ) ;
316- await inputHandler . parseP ( Array ( bufferService . cols - 9 ) . join ( 'a' ) ) ;
316+ await inputHandler . parseP ( 'a' . repeat ( bufferService . cols - 10 ) ) ;
317317 await inputHandler . parseP ( '1234567890' ) ;
318318 const line1 : IBufferLine = bufferService . buffer . lines . get ( 0 ) ! ;
319- assert . equal ( line1 . translateToString ( false ) , Array ( bufferService . cols - 9 ) . join ( 'a' ) + '1234567890' ) ;
319+ assert . equal ( line1 . translateToString ( false ) , 'a' . repeat ( bufferService . cols - 10 ) + '1234567890' ) ;
320320
321321 // insert one char from params = [0]
322322 bufferService . buffer . y = 0 ;
323323 bufferService . buffer . x = 70 ;
324324 inputHandler . insertChars ( Params . fromArray ( [ 0 ] ) ) ;
325- assert . equal ( line1 . translateToString ( false ) , Array ( bufferService . cols - 9 ) . join ( 'a' ) + ' 123456789' ) ;
325+ assert . equal ( line1 . translateToString ( false ) , 'a' . repeat ( bufferService . cols - 10 ) + ' 123456789' ) ;
326326
327327 // insert one char from params = [1]
328328 bufferService . buffer . y = 0 ;
329329 bufferService . buffer . x = 70 ;
330330 inputHandler . insertChars ( Params . fromArray ( [ 1 ] ) ) ;
331- assert . equal ( line1 . translateToString ( false ) , Array ( bufferService . cols - 9 ) . join ( 'a' ) + ' 12345678' ) ;
331+ assert . equal ( line1 . translateToString ( false ) , 'a' . repeat ( bufferService . cols - 10 ) + ' 12345678' ) ;
332332
333333 // insert two chars from params = [2]
334334 bufferService . buffer . y = 0 ;
335335 bufferService . buffer . x = 70 ;
336336 inputHandler . insertChars ( Params . fromArray ( [ 2 ] ) ) ;
337- assert . equal ( line1 . translateToString ( false ) , Array ( bufferService . cols - 9 ) . join ( 'a' ) + ' 123456' ) ;
337+ assert . equal ( line1 . translateToString ( false ) , 'a' . repeat ( bufferService . cols - 10 ) + ' 123456' ) ;
338338
339339 // insert 10 chars from params = [10]
340340 bufferService . buffer . y = 0 ;
341341 bufferService . buffer . x = 70 ;
342342 inputHandler . insertChars ( Params . fromArray ( [ 10 ] ) ) ;
343- assert . equal ( line1 . translateToString ( false ) , Array ( bufferService . cols - 9 ) . join ( 'a' ) + ' ' ) ;
344- assert . equal ( line1 . translateToString ( true ) , Array ( bufferService . cols - 9 ) . join ( 'a' ) ) ;
343+ assert . equal ( line1 . translateToString ( false ) , 'a' . repeat ( bufferService . cols - 10 ) + ' ' ) ;
344+ assert . equal ( line1 . translateToString ( true ) , 'a' . repeat ( bufferService . cols - 10 ) ) ;
345345 } ) ;
346346 it ( 'deleteChars' , async ( ) => {
347347 const bufferService = new MockBufferService ( 80 , 30 ) ;
@@ -357,41 +357,41 @@ describe('InputHandler', () => {
357357 ) ;
358358
359359 // insert some data in first and second line
360- await inputHandler . parseP ( Array ( bufferService . cols - 9 ) . join ( 'a' ) ) ;
360+ await inputHandler . parseP ( 'a' . repeat ( bufferService . cols - 10 ) ) ;
361361 await inputHandler . parseP ( '1234567890' ) ;
362- await inputHandler . parseP ( Array ( bufferService . cols - 9 ) . join ( 'a' ) ) ;
362+ await inputHandler . parseP ( 'a' . repeat ( bufferService . cols - 10 ) ) ;
363363 await inputHandler . parseP ( '1234567890' ) ;
364364 const line1 : IBufferLine = bufferService . buffer . lines . get ( 0 ) ! ;
365- assert . equal ( line1 . translateToString ( false ) , Array ( bufferService . cols - 9 ) . join ( 'a' ) + '1234567890' ) ;
365+ assert . equal ( line1 . translateToString ( false ) , 'a' . repeat ( bufferService . cols - 10 ) + '1234567890' ) ;
366366
367367 // delete one char from params = [0]
368368 bufferService . buffer . y = 0 ;
369369 bufferService . buffer . x = 70 ;
370370 inputHandler . deleteChars ( Params . fromArray ( [ 0 ] ) ) ;
371- assert . equal ( line1 . translateToString ( false ) , Array ( bufferService . cols - 9 ) . join ( 'a' ) + '234567890 ' ) ;
372- assert . equal ( line1 . translateToString ( true ) , Array ( bufferService . cols - 9 ) . join ( 'a' ) + '234567890' ) ;
371+ assert . equal ( line1 . translateToString ( false ) , 'a' . repeat ( bufferService . cols - 10 ) + '234567890 ' ) ;
372+ assert . equal ( line1 . translateToString ( true ) , 'a' . repeat ( bufferService . cols - 10 ) + '234567890' ) ;
373373
374374 // insert one char from params = [1]
375375 bufferService . buffer . y = 0 ;
376376 bufferService . buffer . x = 70 ;
377377 inputHandler . deleteChars ( Params . fromArray ( [ 1 ] ) ) ;
378- assert . equal ( line1 . translateToString ( false ) , Array ( bufferService . cols - 9 ) . join ( 'a' ) + '34567890 ' ) ;
379- assert . equal ( line1 . translateToString ( true ) , Array ( bufferService . cols - 9 ) . join ( 'a' ) + '34567890' ) ;
378+ assert . equal ( line1 . translateToString ( false ) , 'a' . repeat ( bufferService . cols - 10 ) + '34567890 ' ) ;
379+ assert . equal ( line1 . translateToString ( true ) , 'a' . repeat ( bufferService . cols - 10 ) + '34567890' ) ;
380380
381381 // insert two chars from params = [2]
382382 bufferService . buffer . y = 0 ;
383383 bufferService . buffer . x = 70 ;
384384 inputHandler . deleteChars ( Params . fromArray ( [ 2 ] ) ) ;
385- assert . equal ( line1 . translateToString ( false ) , Array ( bufferService . cols - 9 ) . join ( 'a' ) + '567890 ' ) ;
386- assert . equal ( line1 . translateToString ( true ) , Array ( bufferService . cols - 9 ) . join ( 'a' ) + '567890' ) ;
385+ assert . equal ( line1 . translateToString ( false ) , 'a' . repeat ( bufferService . cols - 10 ) + '567890 ' ) ;
386+ assert . equal ( line1 . translateToString ( true ) , 'a' . repeat ( bufferService . cols - 10 ) + '567890' ) ;
387387
388388
389389 // insert 10 chars from params = [10]
390390 bufferService . buffer . y = 0 ;
391391 bufferService . buffer . x = 70 ;
392392 inputHandler . deleteChars ( Params . fromArray ( [ 10 ] ) ) ;
393- assert . equal ( line1 . translateToString ( false ) , Array ( bufferService . cols - 9 ) . join ( 'a' ) + ' ' ) ;
394- assert . equal ( line1 . translateToString ( true ) , Array ( bufferService . cols - 9 ) . join ( 'a' ) ) ;
393+ assert . equal ( line1 . translateToString ( false ) , 'a' . repeat ( bufferService . cols - 10 ) + ' ' ) ;
394+ assert . equal ( line1 . translateToString ( true ) , 'a' . repeat ( bufferService . cols - 10 ) ) ;
395395 } ) ;
396396 it ( 'eraseInLine' , async ( ) => {
397397 const bufferService = new MockBufferService ( 80 , 30 ) ;
@@ -407,27 +407,27 @@ describe('InputHandler', () => {
407407 ) ;
408408
409409 // fill 6 lines to test 3 different states
410- await inputHandler . parseP ( Array ( bufferService . cols + 1 ) . join ( 'a' ) ) ;
411- await inputHandler . parseP ( Array ( bufferService . cols + 1 ) . join ( 'a' ) ) ;
412- await inputHandler . parseP ( Array ( bufferService . cols + 1 ) . join ( 'a' ) ) ;
410+ await inputHandler . parseP ( 'a' . repeat ( bufferService . cols ) ) ;
411+ await inputHandler . parseP ( 'a' . repeat ( bufferService . cols ) ) ;
412+ await inputHandler . parseP ( 'a' . repeat ( bufferService . cols ) ) ;
413413
414414 // params[0] - right erase
415415 bufferService . buffer . y = 0 ;
416416 bufferService . buffer . x = 70 ;
417417 inputHandler . eraseInLine ( Params . fromArray ( [ 0 ] ) ) ;
418- assert . equal ( bufferService . buffer . lines . get ( 0 ) ! . translateToString ( false ) , Array ( 71 ) . join ( 'a' ) + ' ' ) ;
418+ assert . equal ( bufferService . buffer . lines . get ( 0 ) ! . translateToString ( false ) , 'a' . repeat ( 70 ) + ' ' ) ;
419419
420420 // params[1] - left erase
421421 bufferService . buffer . y = 1 ;
422422 bufferService . buffer . x = 70 ;
423423 inputHandler . eraseInLine ( Params . fromArray ( [ 1 ] ) ) ;
424- assert . equal ( bufferService . buffer . lines . get ( 1 ) ! . translateToString ( false ) , Array ( 71 ) . join ( ' ' ) + ' aaaaaaaaa' ) ;
424+ assert . equal ( bufferService . buffer . lines . get ( 1 ) ! . translateToString ( false ) , ' ' . repeat ( 70 ) + ' aaaaaaaaa' ) ;
425425
426426 // params[1] - left erase
427427 bufferService . buffer . y = 2 ;
428428 bufferService . buffer . x = 70 ;
429429 inputHandler . eraseInLine ( Params . fromArray ( [ 2 ] ) ) ;
430- assert . equal ( bufferService . buffer . lines . get ( 2 ) ! . translateToString ( false ) , Array ( bufferService . cols + 1 ) . join ( ' ' ) ) ;
430+ assert . equal ( bufferService . buffer . lines . get ( 2 ) ! . translateToString ( false ) , ' ' . repeat ( bufferService . cols ) ) ;
431431
432432 } ) ;
433433 it ( 'eraseInLine reflow' , async ( ) => {
@@ -447,9 +447,9 @@ describe('InputHandler', () => {
447447 // reset and add a wrapped line
448448 bufferService . buffer . y = 0 ;
449449 bufferService . buffer . x = 0 ;
450- await inputHandler . parseP ( Array ( bufferService . cols + 1 ) . join ( 'a' ) ) ; // line 0
451- await inputHandler . parseP ( Array ( bufferService . cols + 10 ) . join ( 'a' ) ) ; // line 1 and 2
452- for ( let i = 3 ; i < bufferService . rows ; ++ i ) await inputHandler . parseP ( Array ( bufferService . cols + 1 ) . join ( 'a' ) ) ;
450+ await inputHandler . parseP ( 'a' . repeat ( bufferService . cols ) ) ; // line 0
451+ await inputHandler . parseP ( 'a' . repeat ( bufferService . cols + 9 ) ) ; // line 1 and 2
452+ for ( let i = 3 ; i < bufferService . rows ; ++ i ) await inputHandler . parseP ( 'a' . repeat ( bufferService . cols ) ) ;
453453
454454 // confirm precondition that line 2 is wrapped
455455 assert . equal ( bufferService . buffer . lines . get ( 2 ) ! . isWrapped , true ) ;
@@ -491,7 +491,7 @@ describe('InputHandler', () => {
491491 new MockMouseStateService ( ) ,
492492 new MockUnicodeService ( )
493493 ) ;
494- const aLine = Array ( bufferService . cols + 1 ) . join ( 'a' ) ;
494+ const aLine = 'a' . repeat ( bufferService . cols ) ;
495495 // add 2 full lines of text.
496496 await inputHandler . parseP ( aLine ) ;
497497 await inputHandler . parseP ( aLine ) ;
@@ -525,76 +525,76 @@ describe('InputHandler', () => {
525525 ) ;
526526
527527 // fill display with a's
528- for ( let i = 0 ; i < bufferService . rows ; ++ i ) await inputHandler . parseP ( Array ( bufferService . cols + 1 ) . join ( 'a' ) ) ;
528+ for ( let i = 0 ; i < bufferService . rows ; ++ i ) await inputHandler . parseP ( 'a' . repeat ( bufferService . cols ) ) ;
529529
530530 // params [0] - right and below erase
531531 bufferService . buffer . y = 5 ;
532532 bufferService . buffer . x = 40 ;
533533 inputHandler . eraseInDisplay ( Params . fromArray ( [ 0 ] ) ) ;
534534 assert . deepEqual ( termContent ( bufferService , false ) , [
535- Array ( bufferService . cols + 1 ) . join ( 'a' ) ,
536- Array ( bufferService . cols + 1 ) . join ( 'a' ) ,
537- Array ( bufferService . cols + 1 ) . join ( 'a' ) ,
538- Array ( bufferService . cols + 1 ) . join ( 'a' ) ,
539- Array ( bufferService . cols + 1 ) . join ( 'a' ) ,
540- Array ( 40 + 1 ) . join ( 'a' ) + Array ( bufferService . cols - 40 + 1 ) . join ( ' ' ) ,
541- Array ( bufferService . cols + 1 ) . join ( ' ' )
535+ 'a' . repeat ( bufferService . cols ) ,
536+ 'a' . repeat ( bufferService . cols ) ,
537+ 'a' . repeat ( bufferService . cols ) ,
538+ 'a' . repeat ( bufferService . cols ) ,
539+ 'a' . repeat ( bufferService . cols ) ,
540+ 'a' . repeat ( 40 ) + ' ' . repeat ( bufferService . cols - 40 ) ,
541+ ' ' . repeat ( bufferService . cols )
542542 ] ) ;
543543 assert . deepEqual ( termContent ( bufferService , true ) , [
544- Array ( bufferService . cols + 1 ) . join ( 'a' ) ,
545- Array ( bufferService . cols + 1 ) . join ( 'a' ) ,
546- Array ( bufferService . cols + 1 ) . join ( 'a' ) ,
547- Array ( bufferService . cols + 1 ) . join ( 'a' ) ,
548- Array ( bufferService . cols + 1 ) . join ( 'a' ) ,
549- Array ( 40 + 1 ) . join ( 'a' ) ,
544+ 'a' . repeat ( bufferService . cols ) ,
545+ 'a' . repeat ( bufferService . cols ) ,
546+ 'a' . repeat ( bufferService . cols ) ,
547+ 'a' . repeat ( bufferService . cols ) ,
548+ 'a' . repeat ( bufferService . cols ) ,
549+ 'a' . repeat ( 40 ) ,
550550 ''
551551 ] ) ;
552552
553553 // reset
554554 bufferService . buffer . y = 0 ;
555555 bufferService . buffer . x = 0 ;
556- for ( let i = 0 ; i < bufferService . rows ; ++ i ) await inputHandler . parseP ( Array ( bufferService . cols + 1 ) . join ( 'a' ) ) ;
556+ for ( let i = 0 ; i < bufferService . rows ; ++ i ) await inputHandler . parseP ( 'a' . repeat ( bufferService . cols ) ) ;
557557
558558 // params [1] - left and above
559559 bufferService . buffer . y = 5 ;
560560 bufferService . buffer . x = 40 ;
561561 inputHandler . eraseInDisplay ( Params . fromArray ( [ 1 ] ) ) ;
562562 assert . deepEqual ( termContent ( bufferService , false ) , [
563- Array ( bufferService . cols + 1 ) . join ( ' ' ) ,
564- Array ( bufferService . cols + 1 ) . join ( ' ' ) ,
565- Array ( bufferService . cols + 1 ) . join ( ' ' ) ,
566- Array ( bufferService . cols + 1 ) . join ( ' ' ) ,
567- Array ( bufferService . cols + 1 ) . join ( ' ' ) ,
568- Array ( 41 + 1 ) . join ( ' ' ) + Array ( bufferService . cols - 41 + 1 ) . join ( 'a' ) ,
569- Array ( bufferService . cols + 1 ) . join ( 'a' )
563+ ' ' . repeat ( bufferService . cols ) ,
564+ ' ' . repeat ( bufferService . cols ) ,
565+ ' ' . repeat ( bufferService . cols ) ,
566+ ' ' . repeat ( bufferService . cols ) ,
567+ ' ' . repeat ( bufferService . cols ) ,
568+ ' ' . repeat ( 41 ) + 'a' . repeat ( bufferService . cols - 41 ) ,
569+ 'a' . repeat ( bufferService . cols )
570570 ] ) ;
571571 assert . deepEqual ( termContent ( bufferService , true ) , [
572572 '' ,
573573 '' ,
574574 '' ,
575575 '' ,
576576 '' ,
577- Array ( 41 + 1 ) . join ( ' ' ) + Array ( bufferService . cols - 41 + 1 ) . join ( 'a' ) ,
578- Array ( bufferService . cols + 1 ) . join ( 'a' )
577+ ' ' . repeat ( 41 ) + 'a' . repeat ( bufferService . cols - 41 ) ,
578+ 'a' . repeat ( bufferService . cols )
579579 ] ) ;
580580
581581 // reset
582582 bufferService . buffer . y = 0 ;
583583 bufferService . buffer . x = 0 ;
584- for ( let i = 0 ; i < bufferService . rows ; ++ i ) await inputHandler . parseP ( Array ( bufferService . cols + 1 ) . join ( 'a' ) ) ;
584+ for ( let i = 0 ; i < bufferService . rows ; ++ i ) await inputHandler . parseP ( 'a' . repeat ( bufferService . cols ) ) ;
585585
586586 // params [2] - whole screen
587587 bufferService . buffer . y = 5 ;
588588 bufferService . buffer . x = 40 ;
589589 inputHandler . eraseInDisplay ( Params . fromArray ( [ 2 ] ) ) ;
590590 assert . deepEqual ( termContent ( bufferService , false ) , [
591- Array ( bufferService . cols + 1 ) . join ( ' ' ) ,
592- Array ( bufferService . cols + 1 ) . join ( ' ' ) ,
593- Array ( bufferService . cols + 1 ) . join ( ' ' ) ,
594- Array ( bufferService . cols + 1 ) . join ( ' ' ) ,
595- Array ( bufferService . cols + 1 ) . join ( ' ' ) ,
596- Array ( bufferService . cols + 1 ) . join ( ' ' ) ,
597- Array ( bufferService . cols + 1 ) . join ( ' ' )
591+ ' ' . repeat ( bufferService . cols ) ,
592+ ' ' . repeat ( bufferService . cols ) ,
593+ ' ' . repeat ( bufferService . cols ) ,
594+ ' ' . repeat ( bufferService . cols ) ,
595+ ' ' . repeat ( bufferService . cols ) ,
596+ ' ' . repeat ( bufferService . cols ) ,
597+ ' ' . repeat ( bufferService . cols )
598598 ] ) ;
599599 assert . deepEqual ( termContent ( bufferService , true ) , [
600600 '' ,
@@ -609,9 +609,9 @@ describe('InputHandler', () => {
609609 // reset and add a wrapped line
610610 bufferService . buffer . y = 0 ;
611611 bufferService . buffer . x = 0 ;
612- await inputHandler . parseP ( Array ( bufferService . cols + 1 ) . join ( 'a' ) ) ; // line 0
613- await inputHandler . parseP ( Array ( bufferService . cols + 10 ) . join ( 'a' ) ) ; // line 1 and 2
614- for ( let i = 3 ; i < bufferService . rows ; ++ i ) await inputHandler . parseP ( Array ( bufferService . cols + 1 ) . join ( 'a' ) ) ;
612+ await inputHandler . parseP ( 'a' . repeat ( bufferService . cols ) ) ; // line 0
613+ await inputHandler . parseP ( 'a' . repeat ( bufferService . cols + 9 ) ) ; // line 1 and 2
614+ for ( let i = 3 ; i < bufferService . rows ; ++ i ) await inputHandler . parseP ( 'a' . repeat ( bufferService . cols ) ) ;
615615
616616 // params[1] left and above with wrap
617617 // confirm precondition that line 2 is wrapped
@@ -624,9 +624,9 @@ describe('InputHandler', () => {
624624 // reset and add a wrapped line
625625 bufferService . buffer . y = 0 ;
626626 bufferService . buffer . x = 0 ;
627- await inputHandler . parseP ( Array ( bufferService . cols + 1 ) . join ( 'a' ) ) ; // line 0
628- await inputHandler . parseP ( Array ( bufferService . cols + 10 ) . join ( 'a' ) ) ; // line 1 and 2
629- for ( let i = 3 ; i < bufferService . rows ; ++ i ) await inputHandler . parseP ( Array ( bufferService . cols + 1 ) . join ( 'a' ) ) ;
627+ await inputHandler . parseP ( 'a' . repeat ( bufferService . cols ) ) ; // line 0
628+ await inputHandler . parseP ( 'a' . repeat ( bufferService . cols + 9 ) ) ; // line 1 and 2
629+ for ( let i = 3 ; i < bufferService . rows ; ++ i ) await inputHandler . parseP ( 'a' . repeat ( bufferService . cols ) ) ;
630630
631631 // params[1] left and above with wrap
632632 // confirm precondition that line 2 is wrapped
0 commit comments