@@ -8,7 +8,7 @@ import type { IBrowser } from 'browser/Types';
88import { assert } from 'chai' ;
99import { DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine' ;
1010import { CellData } from 'common/buffer/CellData' ;
11- import { MockUnicodeService } from 'common/TestUtils.test' ;
11+ import { MockUnicodeService , createCellData } from 'common/TestUtils.test' ;
1212import { IMarker } from 'common/Types' ;
1313
1414const INIT_COLS = 80 ;
@@ -440,8 +440,8 @@ describe('Terminal', () => {
440440 describe ( 'scroll() function' , ( ) => {
441441 describe ( 'when scrollback > 0' , ( ) => {
442442 it ( 'should create a new line and scroll' , ( ) => {
443- term . buffer . lines . get ( 0 ) ! . setCell ( 0 , CellData . fromCharData ( [ 0 , 'a' , 0 , 'a' . charCodeAt ( 0 ) ] ) ) ;
444- term . buffer . lines . get ( INIT_ROWS - 1 ) ! . setCell ( 0 , CellData . fromCharData ( [ 0 , 'b' , 0 , 'b' . charCodeAt ( 0 ) ] ) ) ;
443+ term . buffer . lines . get ( 0 ) ! . setCell ( 0 , createCellData ( 0 , 'a' , 0 ) ) ;
444+ term . buffer . lines . get ( INIT_ROWS - 1 ) ! . setCell ( 0 , createCellData ( 0 , 'b' , 0 ) ) ;
445445 term . buffer . y = INIT_ROWS - 1 ; // Move cursor to last line
446446 term . scroll ( DEFAULT_ATTR_DATA . clone ( ) ) ;
447447 assert . equal ( term . buffer . lines . length , INIT_ROWS + 1 ) ;
@@ -451,9 +451,9 @@ describe('Terminal', () => {
451451 } ) ;
452452
453453 it ( 'should properly scroll inside a scroll region (scrollTop set)' , ( ) => {
454- term . buffer . lines . get ( 0 ) ! . setCell ( 0 , CellData . fromCharData ( [ 0 , 'a' , 0 , 'a' . charCodeAt ( 0 ) ] ) ) ;
455- term . buffer . lines . get ( 1 ) ! . setCell ( 0 , CellData . fromCharData ( [ 0 , 'b' , 0 , 'b' . charCodeAt ( 0 ) ] ) ) ;
456- term . buffer . lines . get ( 2 ) ! . setCell ( 0 , CellData . fromCharData ( [ 0 , 'c' , 0 , 'c' . charCodeAt ( 0 ) ] ) ) ;
454+ term . buffer . lines . get ( 0 ) ! . setCell ( 0 , createCellData ( 0 , 'a' , 0 ) ) ;
455+ term . buffer . lines . get ( 1 ) ! . setCell ( 0 , createCellData ( 0 , 'b' , 0 ) ) ;
456+ term . buffer . lines . get ( 2 ) ! . setCell ( 0 , createCellData ( 0 , 'c' , 0 ) ) ;
457457 term . buffer . y = INIT_ROWS - 1 ; // Move cursor to last line
458458 term . buffer . scrollTop = 1 ;
459459 term . scroll ( DEFAULT_ATTR_DATA . clone ( ) ) ;
@@ -463,11 +463,11 @@ describe('Terminal', () => {
463463 } ) ;
464464
465465 it ( 'should properly scroll inside a scroll region (scrollBottom set)' , ( ) => {
466- term . buffer . lines . get ( 0 ) ! . setCell ( 0 , CellData . fromCharData ( [ 0 , 'a' , 0 , 'a' . charCodeAt ( 0 ) ] ) ) ;
467- term . buffer . lines . get ( 1 ) ! . setCell ( 0 , CellData . fromCharData ( [ 0 , 'b' , 0 , 'b' . charCodeAt ( 0 ) ] ) ) ;
468- term . buffer . lines . get ( 2 ) ! . setCell ( 0 , CellData . fromCharData ( [ 0 , 'c' , 0 , 'c' . charCodeAt ( 0 ) ] ) ) ;
469- term . buffer . lines . get ( 3 ) ! . setCell ( 0 , CellData . fromCharData ( [ 0 , 'd' , 0 , 'd' . charCodeAt ( 0 ) ] ) ) ;
470- term . buffer . lines . get ( 4 ) ! . setCell ( 0 , CellData . fromCharData ( [ 0 , 'e' , 0 , 'e' . charCodeAt ( 0 ) ] ) ) ;
466+ term . buffer . lines . get ( 0 ) ! . setCell ( 0 , createCellData ( 0 , 'a' , 0 ) ) ;
467+ term . buffer . lines . get ( 1 ) ! . setCell ( 0 , createCellData ( 0 , 'b' , 0 ) ) ;
468+ term . buffer . lines . get ( 2 ) ! . setCell ( 0 , createCellData ( 0 , 'c' , 0 ) ) ;
469+ term . buffer . lines . get ( 3 ) ! . setCell ( 0 , createCellData ( 0 , 'd' , 0 ) ) ;
470+ term . buffer . lines . get ( 4 ) ! . setCell ( 0 , createCellData ( 0 , 'e' , 0 ) ) ;
471471 term . buffer . y = 3 ;
472472 term . buffer . scrollBottom = 3 ;
473473 term . scroll ( DEFAULT_ATTR_DATA . clone ( ) ) ;
@@ -481,11 +481,11 @@ describe('Terminal', () => {
481481 } ) ;
482482
483483 it ( 'should properly scroll inside a scroll region (scrollTop and scrollBottom set)' , ( ) => {
484- term . buffer . lines . get ( 0 ) ! . setCell ( 0 , CellData . fromCharData ( [ 0 , 'a' , 0 , 'a' . charCodeAt ( 0 ) ] ) ) ;
485- term . buffer . lines . get ( 1 ) ! . setCell ( 0 , CellData . fromCharData ( [ 0 , 'b' , 0 , 'b' . charCodeAt ( 0 ) ] ) ) ;
486- term . buffer . lines . get ( 2 ) ! . setCell ( 0 , CellData . fromCharData ( [ 0 , 'c' , 0 , 'c' . charCodeAt ( 0 ) ] ) ) ;
487- term . buffer . lines . get ( 3 ) ! . setCell ( 0 , CellData . fromCharData ( [ 0 , 'd' , 0 , 'd' . charCodeAt ( 0 ) ] ) ) ;
488- term . buffer . lines . get ( 4 ) ! . setCell ( 0 , CellData . fromCharData ( [ 0 , 'e' , 0 , 'e' . charCodeAt ( 0 ) ] ) ) ;
484+ term . buffer . lines . get ( 0 ) ! . setCell ( 0 , createCellData ( 0 , 'a' , 0 ) ) ;
485+ term . buffer . lines . get ( 1 ) ! . setCell ( 0 , createCellData ( 0 , 'b' , 0 ) ) ;
486+ term . buffer . lines . get ( 2 ) ! . setCell ( 0 , createCellData ( 0 , 'c' , 0 ) ) ;
487+ term . buffer . lines . get ( 3 ) ! . setCell ( 0 , createCellData ( 0 , 'd' , 0 ) ) ;
488+ term . buffer . lines . get ( 4 ) ! . setCell ( 0 , createCellData ( 0 , 'e' , 0 ) ) ;
489489 term . buffer . y = INIT_ROWS - 1 ; // Move cursor to last line
490490 term . buffer . scrollTop = 1 ;
491491 term . buffer . scrollBottom = 3 ;
@@ -506,9 +506,9 @@ describe('Terminal', () => {
506506 } ) ;
507507
508508 it ( 'should create a new line and shift everything up' , ( ) => {
509- term . buffer . lines . get ( 0 ) ! . setCell ( 0 , CellData . fromCharData ( [ 0 , 'a' , 0 , 'a' . charCodeAt ( 0 ) ] ) ) ;
510- term . buffer . lines . get ( 1 ) ! . setCell ( 0 , CellData . fromCharData ( [ 0 , 'b' , 0 , 'b' . charCodeAt ( 0 ) ] ) ) ;
511- term . buffer . lines . get ( INIT_ROWS - 1 ) ! . setCell ( 0 , CellData . fromCharData ( [ 0 , 'c' , 0 , 'c' . charCodeAt ( 0 ) ] ) ) ;
509+ term . buffer . lines . get ( 0 ) ! . setCell ( 0 , createCellData ( 0 , 'a' , 0 ) ) ;
510+ term . buffer . lines . get ( 1 ) ! . setCell ( 0 , createCellData ( 0 , 'b' , 0 ) ) ;
511+ term . buffer . lines . get ( INIT_ROWS - 1 ) ! . setCell ( 0 , createCellData ( 0 , 'c' , 0 ) ) ;
512512 term . buffer . y = INIT_ROWS - 1 ; // Move cursor to last line
513513 assert . equal ( term . buffer . lines . length , INIT_ROWS ) ;
514514 term . scroll ( DEFAULT_ATTR_DATA . clone ( ) ) ;
@@ -521,9 +521,9 @@ describe('Terminal', () => {
521521 } ) ;
522522
523523 it ( 'should properly scroll inside a scroll region (scrollTop set)' , ( ) => {
524- term . buffer . lines . get ( 0 ) ! . setCell ( 0 , CellData . fromCharData ( [ 0 , 'a' , 0 , 'a' . charCodeAt ( 0 ) ] ) ) ;
525- term . buffer . lines . get ( 1 ) ! . setCell ( 0 , CellData . fromCharData ( [ 0 , 'b' , 0 , 'b' . charCodeAt ( 0 ) ] ) ) ;
526- term . buffer . lines . get ( 2 ) ! . setCell ( 0 , CellData . fromCharData ( [ 0 , 'c' , 0 , 'c' . charCodeAt ( 0 ) ] ) ) ;
524+ term . buffer . lines . get ( 0 ) ! . setCell ( 0 , createCellData ( 0 , 'a' , 0 ) ) ;
525+ term . buffer . lines . get ( 1 ) ! . setCell ( 0 , createCellData ( 0 , 'b' , 0 ) ) ;
526+ term . buffer . lines . get ( 2 ) ! . setCell ( 0 , createCellData ( 0 , 'c' , 0 ) ) ;
527527 term . buffer . y = INIT_ROWS - 1 ; // Move cursor to last line
528528 term . buffer . scrollTop = 1 ;
529529 term . scroll ( DEFAULT_ATTR_DATA . clone ( ) ) ;
@@ -533,11 +533,11 @@ describe('Terminal', () => {
533533 } ) ;
534534
535535 it ( 'should properly scroll inside a scroll region (scrollBottom set)' , ( ) => {
536- term . buffer . lines . get ( 0 ) ! . setCell ( 0 , CellData . fromCharData ( [ 0 , 'a' , 0 , 'a' . charCodeAt ( 0 ) ] ) ) ;
537- term . buffer . lines . get ( 1 ) ! . setCell ( 0 , CellData . fromCharData ( [ 0 , 'b' , 0 , 'b' . charCodeAt ( 0 ) ] ) ) ;
538- term . buffer . lines . get ( 2 ) ! . setCell ( 0 , CellData . fromCharData ( [ 0 , 'c' , 0 , 'c' . charCodeAt ( 0 ) ] ) ) ;
539- term . buffer . lines . get ( 3 ) ! . setCell ( 0 , CellData . fromCharData ( [ 0 , 'd' , 0 , 'd' . charCodeAt ( 0 ) ] ) ) ;
540- term . buffer . lines . get ( 4 ) ! . setCell ( 0 , CellData . fromCharData ( [ 0 , 'e' , 0 , 'e' . charCodeAt ( 0 ) ] ) ) ;
536+ term . buffer . lines . get ( 0 ) ! . setCell ( 0 , createCellData ( 0 , 'a' , 0 ) ) ;
537+ term . buffer . lines . get ( 1 ) ! . setCell ( 0 , createCellData ( 0 , 'b' , 0 ) ) ;
538+ term . buffer . lines . get ( 2 ) ! . setCell ( 0 , createCellData ( 0 , 'c' , 0 ) ) ;
539+ term . buffer . lines . get ( 3 ) ! . setCell ( 0 , createCellData ( 0 , 'd' , 0 ) ) ;
540+ term . buffer . lines . get ( 4 ) ! . setCell ( 0 , createCellData ( 0 , 'e' , 0 ) ) ;
541541 term . buffer . y = 3 ;
542542 term . buffer . scrollBottom = 3 ;
543543 term . scroll ( DEFAULT_ATTR_DATA . clone ( ) ) ;
@@ -550,11 +550,11 @@ describe('Terminal', () => {
550550 } ) ;
551551
552552 it ( 'should properly scroll inside a scroll region (scrollTop and scrollBottom set)' , ( ) => {
553- term . buffer . lines . get ( 0 ) ! . setCell ( 0 , CellData . fromCharData ( [ 0 , 'a' , 0 , 'a' . charCodeAt ( 0 ) ] ) ) ;
554- term . buffer . lines . get ( 1 ) ! . setCell ( 0 , CellData . fromCharData ( [ 0 , 'b' , 0 , 'b' . charCodeAt ( 0 ) ] ) ) ;
555- term . buffer . lines . get ( 2 ) ! . setCell ( 0 , CellData . fromCharData ( [ 0 , 'c' , 0 , 'c' . charCodeAt ( 0 ) ] ) ) ;
556- term . buffer . lines . get ( 3 ) ! . setCell ( 0 , CellData . fromCharData ( [ 0 , 'd' , 0 , 'd' . charCodeAt ( 0 ) ] ) ) ;
557- term . buffer . lines . get ( 4 ) ! . setCell ( 0 , CellData . fromCharData ( [ 0 , 'e' , 0 , 'e' . charCodeAt ( 0 ) ] ) ) ;
553+ term . buffer . lines . get ( 0 ) ! . setCell ( 0 , createCellData ( 0 , 'a' , 0 ) ) ;
554+ term . buffer . lines . get ( 1 ) ! . setCell ( 0 , createCellData ( 0 , 'b' , 0 ) ) ;
555+ term . buffer . lines . get ( 2 ) ! . setCell ( 0 , createCellData ( 0 , 'c' , 0 ) ) ;
556+ term . buffer . lines . get ( 3 ) ! . setCell ( 0 , createCellData ( 0 , 'd' , 0 ) ) ;
557+ term . buffer . lines . get ( 4 ) ! . setCell ( 0 , createCellData ( 0 , 'e' , 0 ) ) ;
558558 term . buffer . y = INIT_ROWS - 1 ; // Move cursor to last line
559559 term . buffer . scrollTop = 1 ;
560560 term . buffer . scrollBottom = 3 ;
0 commit comments