Skip to content
This repository has been archived by the owner on Jun 15, 2019. It is now read-only.

Colors in word-wrapped table bleed when closing ANSI sequence wrapped in newlines #34

Open
jfr3000 opened this issue May 9, 2017 · 0 comments

Comments

@jfr3000
Copy link

jfr3000 commented May 9, 2017

This is an edge case, but it managed to trip me up. Failing test:

 it('wordWrap with colored text should not bleed',function(){
    var table = new Table({style:{border:[],head:[]},wordWrap:true,colWidths:[8]});

    table.push([colors.blue('Hello how are you?\n') + '\nthis should be white']);

    var expected = [ 
        '┌────────┐'
      , '│ ' + colors.blue('Hello') + '  │'
      , '│ ' + colors.blue('how') + '    │'
      , '│ ' + colors.blue('are') + '    │'
      , '│ ' + colors.blue('you?') + '   │'
      , '│ ' + 'this' + '   │'
      , '│ ' + 'should' + ' │'
      , '│ ' + 'be' + '     │'
      , '│ ' + 'white' + '  │'
      , '└────────┘'
    ];  

    expect(table.toString()).to.equal(expected.join('\n'));
  }); 
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant