echo -e "a b c\na b c" | ./column --table --table-column "name=X,width=5" -C "name=YY,width=5" -C "name=Z" --output-separator '|'
X |YY|Z
a |b |c
a |b |c
The only difference between the X and YY columns is the column name.
The column header width affects the use of the width property. This
occurs when the minimum and maximum column widths are the same ("YY").
Fixed version:
echo -e "a b c\na b c" | ./column --table --table-column "name=X,width=5" -C "name=YY,width=5" -C "name=Z" --output-separator '|'
X|YY|Z
a|b |c
a|b |c
Note that width= is just a hint and should not be used when the
'strictwidth' property is not specified.
Signed-off-by: Karel Zak <kzak@redhat.com>
cl->width = st->width_max;
/* enlarge to minimal width */
- if (cl->width < st->width_min && !scols_column_is_strict_width(cl))
+ if (cl->width <= st->width_min && !scols_column_is_strict_width(cl))
cl->width = st->width_min;
/* use absolute size for large columns */
--- /dev/null
+X|YY|Z
+a|b |c
+a|b |c
echo -e 'COL1\t\tCOL3\nData1\tData2\tData3' | $TS_CMD_COLUMN --table -K >> $TS_OUTPUT 2>> $TS_ERRLOG
ts_finalize_subtest
+ts_init_subtest "min-width"
+echo -e "a b c\na b c" | $TS_CMD_COLUMN --table --table-column "name=X,width=5" -C "name=YY,width=5" -C "name=Z" --output-separator '|' --output-width unlimited >> $TS_OUTPUT 2>> $TS_ERRLOG
+ts_finalize_subtest
+
ts_finalize