@@ -355,7 +355,7 @@ describe('Buffer', () => {
355355 let terminal : TestTerminal ;
356356
357357 beforeEach ( ( ) => {
358- terminal = new TestTerminal ( { rows : 5 , cols : 10 } ) ;
358+ terminal = new TestTerminal ( { rows : 5 , cols : 10 , scrollback : 5 } ) ;
359359 } ) ;
360360
361361 it ( 'multiline ascii' , ( ) => {
@@ -516,9 +516,38 @@ describe('Buffer', () => {
516516 assert . deepEqual ( [ ( j / terminal . cols ) | 0 , j % terminal . cols ] , bufferIndex ) ;
517517 }
518518 } ) ;
519+
520+ it ( 'test fully wrapped buffer up to last char' , ( ) => {
521+ const input = Array ( 6 ) . join ( '1234567890' ) ;
522+ terminal . writeSync ( input ) ;
523+ const s = terminal . buffer . iterator ( true ) . next ( ) . content ;
524+ assert . equal ( input , s ) ;
525+ for ( let i = 0 ; i < input . length ; ++ i ) {
526+ const bufferIndex = terminal . buffer . stringIndexToBufferIndex ( 0 , i ) ;
527+ assert . equal ( input [ i ] , terminal . buffer . lines . get ( bufferIndex [ 0 ] ) . get ( bufferIndex [ 1 ] ) [ CHAR_DATA_CHAR_INDEX ] ) ;
528+ }
529+ } ) ;
530+
531+ it ( 'test fully wrapped buffer up to last char with full width odd' , ( ) => {
532+ const input = 'a¥\u0301a¥\u0301a¥\u0301a¥\u0301a¥\u0301a¥\u0301a¥\u0301a¥\u0301'
533+ + 'a¥\u0301a¥\u0301a¥\u0301a¥\u0301a¥\u0301a¥\u0301a¥\u0301' ;
534+ terminal . writeSync ( input ) ;
535+ const s = terminal . buffer . iterator ( true ) . next ( ) . content ;
536+ assert . equal ( input , s ) ;
537+ for ( let i = 0 ; i < input . length ; ++ i ) {
538+ const bufferIndex = terminal . buffer . stringIndexToBufferIndex ( 0 , i ) ;
539+ assert . equal (
540+ ( ! ( i % 3 ) )
541+ ? input [ i ]
542+ : ( i % 3 === 1 )
543+ ? input . substr ( i , 2 )
544+ : input . substr ( i - 1 , 2 ) ,
545+ terminal . buffer . lines . get ( bufferIndex [ 0 ] ) . get ( bufferIndex [ 1 ] ) [ CHAR_DATA_CHAR_INDEX ] ) ;
546+ }
547+ } ) ;
519548 } ) ;
520549 describe ( 'BufferStringIterator' , function ( ) : void {
521- it ( 'iterator does not ovrflow buffer limits' , function ( ) : void {
550+ it ( 'iterator does not overflow buffer limits' , function ( ) : void {
522551 const terminal = new TestTerminal ( { rows : 5 , cols : 10 , scrollback : 5 } ) ;
523552 const data = [
524553 'aaaaaaaaaa' ,
0 commit comments