mirror of
https://github.com/postgres/postgres.git
synced 2025-05-18 17:41:14 +03:00
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.
This commit is contained in:
parent
25bf13fe1b
commit
7ec3990944
@ -1085,16 +1085,15 @@ cleanup:
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_aligned_vertical_line(const printTableContent *cont,
|
print_aligned_vertical_line(const printTextFormat *format,
|
||||||
|
const unsigned short opt_border,
|
||||||
unsigned long record,
|
unsigned long record,
|
||||||
unsigned int hwidth,
|
unsigned int hwidth,
|
||||||
unsigned int dwidth,
|
unsigned int dwidth,
|
||||||
printTextRule pos,
|
printTextRule pos,
|
||||||
FILE *fout)
|
FILE *fout)
|
||||||
{
|
{
|
||||||
const printTextFormat *format = get_line_style(cont->opt);
|
|
||||||
const printTextLineFormat *lformat = &format->lrule[pos];
|
const printTextLineFormat *lformat = &format->lrule[pos];
|
||||||
unsigned short opt_border = cont->opt->border;
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int reclen = 0;
|
int reclen = 0;
|
||||||
|
|
||||||
@ -1255,11 +1254,11 @@ print_aligned_vertical(const printTableContent *cont, FILE *fout)
|
|||||||
if (i % cont->ncolumns == 0)
|
if (i % cont->ncolumns == 0)
|
||||||
{
|
{
|
||||||
if (!opt_tuples_only)
|
if (!opt_tuples_only)
|
||||||
print_aligned_vertical_line(cont, record++, hwidth, dwidth,
|
print_aligned_vertical_line(format, opt_border, record++,
|
||||||
pos, fout);
|
hwidth, dwidth, pos, fout);
|
||||||
else if (i != 0 || !cont->opt->start_table || opt_border == 2)
|
else if (i != 0 || !cont->opt->start_table || opt_border == 2)
|
||||||
print_aligned_vertical_line(cont, 0, hwidth, dwidth,
|
print_aligned_vertical_line(format, opt_border, 0, hwidth,
|
||||||
pos, fout);
|
dwidth, pos, fout);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Format the header */
|
/* Format the header */
|
||||||
@ -1318,7 +1317,7 @@ print_aligned_vertical(const printTableContent *cont, FILE *fout)
|
|||||||
if (cont->opt->stop_table)
|
if (cont->opt->stop_table)
|
||||||
{
|
{
|
||||||
if (opt_border == 2 && !cancel_pressed)
|
if (opt_border == 2 && !cancel_pressed)
|
||||||
print_aligned_vertical_line(cont, 0, hwidth, dwidth,
|
print_aligned_vertical_line(format, opt_border, 0, hwidth, dwidth,
|
||||||
PRINT_RULE_BOTTOM, fout);
|
PRINT_RULE_BOTTOM, fout);
|
||||||
|
|
||||||
/* print footers */
|
/* print footers */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user