p-ranav / tabulate

Table Maker for Modern C++

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hide border doesn't affect the output once the table has been printed

dfalbel opened this issue · comments

Hello there,

Thanks very much for this library. I'm working on bindings for the R language.
I encountered this behavior where modifying hide_border_bottom() won't modify the output if the table has been printed some time before.

For example:

#include <tabulate/table.hpp>
using namespace tabulate;
using Row_t = Table::Row_t;

int main() {
  Table table;
  table.add_row(Row_t{"hello"});
  table.add_row(Row_t{"world"});

  std::cout << table << std::endl;

  table.format().hide_border_bottom();

  std::cout << table << std::endl;

  table.format().width(50);

  std::cout << table << std::endl;
}

Returns:

+-------+
| hello |
+-------+
| world |
+-------+
+-------+
| hello |
+-------+
| world |
+-------+
+--------------------------------------------------+
| hello                                            |
+--------------------------------------------------+
| world                                            |
+--------------------------------------------------+