8000 Handle border = 3 in expanded mode · pykello/postgres@4d96e93 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4d96e93

Browse files
committed
Handle border = 3 in expanded mode
In psql, expanded mode was not being displayed correctly when using the normal ascii or unicode linestyles and border set to '3'. Now, per the documentation, border '3' is really only sensible for HTML and LaTeX formats, however, that's no excuse for ascii/unicode to break in that case, and provisions had been made for psql to cleanly handle this case (and it did, in non-expanded mode). This was broken when ascii/unicode was initially added a good five years ago because print_aligned_vertical_line wasn't passed in the border setting being used by print_aligned_vertical but instead was given the whole printTableContent. There really isn't a good reason for vertical_line to have the entire printTableContent structure, so just pass in the printTextFormat and border setting (similar to how this is handled in horizontal_line). Pointed out by Pavel Stehule, fix by me. Back-patch to all currently-supported versions.
1 parent cf5c20b commit 4d96e93

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/bin/psql/print.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,16 +1050,15 @@ print_aligned_text(const printTableContent *cont, FILE *fout)
10501050

10511051

10521052
static void
1053-
print_aligned_vertical_line(const printTableContent *cont,
1053+
print_aligned_vertical_line(const printTextFormat *format,
1054+
const unsigned short opt_border,
10541055
unsigned long record,
10551056
unsigned int hwidth,
10561057
unsigned int dwidth,
10571058
printTextRule pos,
10581059
FILE *fout)
10591060
{
1060-
const printTextFormat *format = get_line_style(cont->opt);
10611061
const printTextLineFormat *lformat = &format->lrule[pos];
1062-
unsigned short opt_border = cont->opt->border;
10631062
unsigned int i;
10641063
int reclen = 0;
10651064

@@ -1211,11 +1210,11 @@ print_aligned_vertical(const printTableContent *cont, FILE *fout)
12111210
if (i % cont->ncolumns == 0)
12121211
{
12131212
if (!opt_tuples_only)
1214-
print_aligned_vertical_line(cont, record++, hwidth, dwidth,
1215-
pos, fout);
1213+
print_aligned_vertical_line(format, opt_border, record++,
1214+
hwidth, dwidth, pos, fout);
12161215
else if (i != 0 || !cont->opt->start_table || opt_border == 2)
1217-
print_aligned_vertical_line(cont, 0, hwidth, dwidth,
1218-
pos, fout);
1216+
print_aligned_vertical_line(format, opt_border, 0, hwidth,
1217+
dwidth, pos, fout);
12191218
}
12201219

12211220
/* Format the header */
@@ -1274,7 +1273,7 @@ print_aligned_vertical(const printTableContent *cont, FILE *fout)
12741273
if (cont->opt->stop_table)
12751274
{
12761275
if (opt_border == 2 && !cancel_pressed)
1277-
print_aligned_vertical_line(cont, 0, hwidth, dwidth,
1276+
print_aligned_vertical_line(format, opt_border, 0, hwidth, dwidth,
12781277
PRINT_RULE_BOTTOM, fout);
12791278

12801279
/* print footers */

0 commit comments

Comments
 (0)
0