Skip to content

Commit 3970e96

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

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
@@ -294,7 +294,10 @@ int table_add_columns(struct table *t, struct table_column *c, int num_columns)
294294
goto free_col;
295295

296296
t->columns[col].align = c[col].align;
297-
t->columns[col].width = strlen(t->columns[col].name);
297+
if (c[col].width > strlen(t->columns[col].name))
298+
t->columns[col].width = c[col].width;
299+
else
300+
t->columns[col].width = strlen(t->columns[col].name);
298301
}
299302
t->num_columns = num_columns;
300303

0 commit comments

Comments
 (0)