From bd6b5a6498d7a33983cde032a42186fa1e534d0d Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 11 Apr 2017 13:48:02 +0200 Subject: column: force to follow specified width Signed-off-by: Karel Zak --- text-utils/column.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'text-utils/column.c') diff --git a/text-utils/column.c b/text-utils/column.c index 3b582ca1d..c22de90ce 100644 --- a/text-utils/column.c +++ b/text-utils/column.c @@ -341,6 +341,7 @@ static void create_tree(struct column_control *ctl) static void modify_table(struct column_control *ctl) { scols_table_set_termwidth(ctl->tab, ctl->termwidth); + scols_table_set_termforce(ctl->tab, SCOLS_TERMFORCE_ALWAYS); if (ctl->tab_colright) apply_columnflag_from_list(ctl, ctl->tab_colright, @@ -578,7 +579,8 @@ int main(int argc, char **argv) { struct column_control ctl = { .mode = COLUMN_MODE_FILLCOLS, - .greedy = 1 + .greedy = 1, + .termwidth = (size_t) -1 }; int c; @@ -620,7 +622,6 @@ int main(int argc, char **argv) textdomain(PACKAGE); atexit(close_stdout); - ctl.termwidth = get_terminal_width(80); ctl.output_separator = " "; ctl.input_separator = mbs_to_wcs("\t "); @@ -696,6 +697,9 @@ int main(int argc, char **argv) argc -= optind; argv += optind; + if (ctl.termwidth == (size_t) -1) + ctl.termwidth = get_terminal_width(80); + if (ctl.tree) { ctl.mode = COLUMN_MODE_TABLE; if (!ctl.tree_parent || !ctl.tree_id) -- cgit v1.2.3-55-g7522