cli-table / cli-table3

Pretty unicode tables for the command line
MIT License
535 stars 44 forks source link

RowSpan extra column #269

Closed markmadlangbayan closed 2 years ago

markmadlangbayan commented 2 years ago

My intention is to produce a table that looks like this:

┌────┬────┬────┐
│ A1 │ B1 │ C1 │
│    ├────┼────┤
│    │ B2 │ C2 │
│    │    ├────┤
│    │    │ C3 │ 
└────┴────┴────┘

For some reason, it looks like this:

┌────┬────┬────┐
│ A1 │ B1 │ C1 │
│    ├────┼────┤
│    │ B2 │ C2 │
│    │    ├────├────┤
│    │    │ C3 │    │
└────┴────┴────┴────┘
    const tbl = new Table();
    tbl.push([ { rowSpan: 3, content: 'A1' }, 'B1', 'C1'], 
             [ { rowSpan: 2, content: 'B2' }, 'C2'],
             ['C3']);
    console.log(tbl.toString());

I can remove the extra column in this example by making the third row an empty array, but I do need to display 'C3'.

I saw PR 187, so I thought it is already fixed. I verified that I have the code, but still getting that extra column.

speedytwenty commented 2 years ago

Thanks for the detailed explanation and providing code to quickly reproduce the issue. While I haven't found a solution yet, I have discovered the problem. When the C3 cell is checked, it's X results as "1" when it should result as "2". I'll try to take another stab at it when time permits.