diff --git a/src/bin/psql/print.c b/src/bin/psql/print.c index 62850d8..474d64b 100644 --- a/src/bin/psql/print.c +++ b/src/bin/psql/print.c @@ -1259,25 +1259,37 @@ print_aligned_vertical(const printTableContent *cont, FILE *fout) { /* * Calculate the available width to wrap the columns to after * subtracting the maximum header width and separators. At a minimum * enough to print "[ RECORD N ]" */ unsigned int width, swidth; if (opt_border == 0) - swidth = 1; /* "header data" */ + /* + * Minimum width used for seperators is 4: a space at the begging, + * two spaces in the middle and one more at the end of the lines. + */ + swidth = 4; else if (opt_border == 1) - swidth = 3; /* "header | data" */ + /* + * For border = 1, one more for the pipe (|) in the middle + * between the two spaces. + */ + swidth = 5; else - swidth = 7; /* "| header | data |" */ + /* + * For border = 2, two more for the pipes (|) at the begging and + * at the end of the lines. + */ + swidth = 7; /* Wrap to maximum width */ width = dwidth + swidth + hwidth; if ((output_columns > 0) && (width > output_columns)) { dwidth = output_columns - hwidth - swidth; width = output_columns; } /* Wrap to minimum width */