| 3 | using Row_t = Table::Row_t; |
| 4 | |
| 5 | int main() { |
| 6 | // Cell contents that already carry their own ANSI escape sequences, e.g. |
| 7 | // strings colored by the application or produced by a nested table |
| 8 | const std::string red = "\x1b[31mred\x1b[0m"; |
| 9 | const std::string naive = "\x1b[1mnaïve\x1b[0m"; |
| 10 | |
| 11 | Table table; |
| 12 | table.add_row(Row_t{"content", "visible width"}); |
| 13 | table.add_row(Row_t{red, "3"}); |
| 14 | table.add_row(Row_t{naive, "5"}); |
| 15 | table.format().multi_byte_characters(true); |
| 16 | |
| 17 | // The escape sequences occupy no columns, so the first column is three |
| 18 | // characters wide and the borders line up with what the terminal shows |
| 19 | std::cout << table << std::endl; |
| 20 | } |