Re: Use of pager, help, localization: - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Use of pager, help, localization:
Date
Msg-id 17075.1539633162@sss.pgh.pa.us
Whole thread Raw
In response to Use of pager, help, localization:  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg11rc1 DROP INDEX: NOTICE: drop_trigger
Next
From: Justin Pryzby
Date:
Subject: Re: pg11rc1 DROP INDEX: NOTICE: drop_trigger