Skip to content

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

@floratmin

Description

@floratmin

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions