diff --git a/src/shared/format-table.c b/src/shared/format-table.c index 946d29b870..9a19177fde 100644 --- a/src/shared/format-table.c +++ b/src/shared/format-table.c @@ -2577,6 +2577,14 @@ size_t table_get_columns(Table *t) { return t->n_columns; } +size_t table_get_current_column(Table *t) { + if (!t) + return 0; + + assert(t->n_columns > 0); + return t->n_cells % t->n_columns; +} + int table_set_reverse(Table *t, size_t column, bool b) { assert(t); assert(column < t->n_columns); diff --git a/src/shared/format-table.h b/src/shared/format-table.h index 7653ad3243..37bfbca693 100644 --- a/src/shared/format-table.h +++ b/src/shared/format-table.h @@ -141,6 +141,8 @@ static inline TableCell* TABLE_HEADER_CELL(size_t i) { size_t table_get_rows(Table *t); size_t table_get_columns(Table *t); +size_t table_get_current_column(Table *t); + TableCell *table_get_cell(Table *t, size_t row, size_t column); const void *table_get(Table *t, TableCell *cell);