Use of pager, help, localization:

Started by Daniele Varrazzoabout 7 years ago2 messages
#1Daniele Varrazzo
daniele.varrazzo@gmail.com

From psql/help.c

/*
* Keep this line count in sync with the number of lines printed below!
* Use "psql --help=variables | wc" to count correctly; but notice that
* Windows builds currently print one more line than non-Windows builds.
* Using the larger number is fine.
*/
output = PageOutput(156, pager ? &(pset.popt.topt) : NULL);

uhm... this doesn't work at all with i10n, above all if respecting an
80 cols width.

Wouldn't be better to generate the output in a temp buffer after l10n,
count the line, then choose whether to use a pager or not?

Can provide a patch if you deem so.

-- Daniele

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Daniele Varrazzo (#1)
Re: Use of pager, help, localization:

Daniele Varrazzo <daniele.varrazzo@gmail.com> writes:

From psql/help.c
/*
* Keep this line count in sync with the number of lines printed below!
* Use "psql --help=variables | wc" to count correctly; but notice that
* Windows builds currently print one more line than non-Windows builds.
* Using the larger number is fine.
*/
output = PageOutput(156, pager ? &(pset.popt.topt) : NULL);

uhm... this doesn't work at all with i10n, above all if respecting an
80 cols width.
Wouldn't be better to generate the output in a temp buffer after l10n,
count the line, then choose whether to use a pager or not?

Don't think it's really worth the trouble, because this ends up being
just a binary decision (use pager or no). Supposing that the true
line count post-localization is, say, 165 --- it would only matter if
the vertical height of your terminal window is between 156 and 164 lines.
And even if it is, the worst-case effect is that a couple of lines would
scroll off the top and you'd have to scroll down to get them back.

If this number were more critical, we'd have come up with some technology
to get it more correct; but in practice I think anything much over 100
is probably a don't-care for most people.

regards, tom lane