column: fix off-by-one default width

By default we want to fill the whole screen if possible, but we do not want to use up _all_ terminal columns because the last character is going hit the border, push the cursor over and wrap. Keep it at default value zero, which will make print_columns() set the width at term_columns() - 1. This affects the test in t7004 because effective column width before was 40 but now 39 so we need to compensate it by one or the output at 39 columns has a different layout. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed May 11, 2018 at 14:13 UTC b5d5a567fbc1eda911f91a8c78731028065bbed8
2 files changed +1 -2
builtin/column.c
-1
@@ -42,7 +42,6 @@ int cmd_column(int argc, const char **argv, const char *prefix)
42 git_config(column_config, NULL);
43
44 memset(&copts, 0, sizeof(copts));
45 - copts.width = term_columns();
45 copts.padding = 1;
46 argc = parse_options(argc, argv, "", options, builtin_column_usage, 0);
47 if (argc)
t/t7004-tag.sh
+1 -1
@@ -363,7 +363,7 @@ test_expect_success 'tag -l <pattern> -l <pattern> works, as our buggy documenta
363 '
364
365 test_expect_success 'listing tags in column' '
366 - COLUMNS=40 git tag -l --column=row >actual &&
366 + COLUMNS=41 git tag -l --column=row >actual &&
367 cat >expected <<\EOF &&
368 a1 aa1 cba t210 t211
369 v0.2.1 v1.0 v1.0.1 v1.1.3