Skip to content

Commit ccd621f

Browse files
committed
util: allow table_add_columns() to set comumn width
The value auto populated but change it for the existing tables. Signed-off-by: Tokunori Ikegami <[email protected]>
1 parent 7b5e202 commit ccd621f

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

util/table.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,10 @@ int table_add_columns(struct table *t, struct table_column *c, int num_columns)
291291
goto free_col;
292292

293293
t->columns[col].align = c[col].align;
294-
t->columns[col].width = strlen(t->columns[col].name);
294+
if (c[col].width > strlen(t->columns[col].name))
295+
t->columns[col].width = c[col].width;
296+
else
297+
t->columns[col].width = strlen(t->columns[col].name);
295298
}
296299
t->num_columns = num_columns;
297300

0 commit comments

Comments
 (0)