Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 8296283

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 acd08d7 commit 8296283

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/bin/psql/print.c

+7-8
Original file line numberDiff line numberDiff line change
@@ -1085,16 +1085,15 @@ print_aligned_text(const printTableContent *cont, FILE *fout)
10851085

10861086

10871087
static void
1088-
print_aligned_vertical_line(const printTableContent *cont,
1088+
print_aligned_vertical_line(const printTextFormat *format,
1089+
const unsigned short opt_border,
10891090
unsigned long record,
10901091
unsigned int hwidth,
10911092
unsigned int dwidth,
10921093
printTextRule pos,
10931094
FILE *fout)
10941095
{
1095-
const printTextFormat *format = get_line_style(cont->opt);
10961096
const printTextLineFormat *lformat = &format->lrule[pos];
1097-
unsigned short opt_border = cont->opt->border;
10981097
unsigned int i;
10991098
int reclen = 0;
11001099

@@ -1373,11 +1372,11 @@ print_aligned_vertical(const printTableContent *cont, FILE *fout)
13731372
lhwidth++; /* for newline indicators */
13741373

13751374
if (!opt_tuples_only)
1376-
print_aligned_vertical_line(cont, record++, lhwidth,
1377-
dwidth, pos, fout);
1375+
print_aligned_vertical_line(format, opt_border, record++,
1376+
lhwidth, dwidth, pos, fout);
13781377
else if (i != 0 || !cont->opt->start_table || opt_border == 2)
1379-
print_aligned_vertical_line(cont, 0, lhwidth, dwidth,
1380-
pos, fout);
1378+
print_aligned_vertical_line(format, opt_border, 0, lhwidth,
1379+
dwidth, pos, fout);
13811380
}
13821381

13831382
/* Format the header */
@@ -1562,7 +1561,7 @@ print_aligned_vertical(const printTableContent *cont, FILE *fout)
15621561
if (cont->opt->stop_table)
15631562
{
15641563
if (opt_border == 2 && !cancel_pressed)
1565-
print_aligned_vertical_line(cont, 0, hwidth, dwidth,
1564+
print_aligned_vertical_line(format, opt_border, 0, hwidth, dwidth,
15661565
PRINT_RULE_BOTTOM, fout);
15671566

15681567
/* print footers */

0 commit comments

Comments
 (0)