Re: psql: Count all table footer lines in pager setup

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Erik Wienhold <ewie@ewie.name>
Cc: Greg Sabino Mullane <htamfids@gmail.com>, pgsql-hackers@postgresql.org
Date: 2025-08-17T15:19:22Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Improve psql's ability to select pager mode accurately.

Erik Wienhold <ewie@ewie.name> writes:
> On 2025-08-11 20:28 +0200, Greg Sabino Mullane wrote:
>> Patch looks good, applies and works. Needs a pgindent run:

> Thanks for the review.  Here's v2 with proper formatting.

This appears to fix the problem it sets out to fix, but it looks
to me like there are adjacent problems of the same ilk; do you
feel like looking at those?

Specifically, I wondered whether we had the same bug with table
headers or cells that contain newlines.  It looks like
print_aligned_text() is okay, because it counts up those newlines
and includes them in the extra_output_lines value that it passes
to IsPagerNeeded().  But print_aligned_vertical() and printTable()
have no such logic.  Am I missing something about why those cases
need not consider this issue?  If not, can we fix that by moving
all the "extra_lines" logic into IsPagerNeeded(), and if not
what shall we do about it?

			regards, tom lane