gajus / table

Formats data into a string table.
Other
904 stars 76 forks source link

drawHorizontalLine counts lines wrong when used together with overlong lines, wordWrap or truncate #123

Closed floratmin closed 3 years ago

floratmin commented 4 years ago

I have e.g a table like this:

const config = {
  columns: {
    0: {
      alignment: 'left',
      width: 10
    },
    1: {
      alignment: 'left',
      width: 10,
      // optional e.g.: wrapWord: true or truncate: 15
    }
  },
  drawHorizontalLine: (index, size) => index === 0 || index === size ,
}

const data = [['hello', 'world'], ['more', 'from hello world']];

console.log(table(data, config))

Then the size counts the lines together with the lines which get wrapped. Therefore the horizonal line in the last row will not be shown.

Expected behaviour: Lines will be shown relative to the table row.

gajus commented 3 years ago

:tada: This issue has been resolved in version 6.5.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: