This tiny change fixes what I think is a longstanding bug in psql. I
causes the first line of every cell to be counted twice, whereas it
should in fact be excluded from extra_lines / extra_row_output_lines.
The bug appears to date back to commit 43ee2282 in 2008. Changing it
appears to make my proposed pager_min_lines feature work as expected.
So, should it be backpatched? It's a behaviour change, albeit that the
existing behaviour is a bug, and will cause the pager to be invoked on
output that is way too short (by about half a screen's height, I think).
cheers
andrew
diff --git a/src/bin/psql/print.c b/src/bin/psql/print.c
index 2e158b8..c93f744 100644
--- a/src/bin/psql/print.c
+++ b/src/bin/psql/print.c
@@ -837,7 +837,7 @@ print_aligned_text(const printTableContent *cont,
FILE *fout)
{
unsigned int extra_lines;
- extra_lines = (width - 1) / width_wrap[i] + nl_lines;
+ extra_lines = ((width - 1) / width_wrap[i]) + (nl_lines
- 1);
if (extra_lines > extra_row_output_lines)
extra_row_output_lines = extra_lines;
}
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers