Re: Proposed patch - psql wraps at window width

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Bryce Nesbitt <bryce2(at)obviously(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org, heikki(at)enterprisedb(dot)com
Subject: Re: Proposed patch - psql wraps at window width
Date: 2008-04-21 15:29:05
Message-ID: 200804211529.m3LFT5S05321@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Bryce Nesbitt wrote:
> 1) "\pset columns XX" should make it clear that's for file output only.

OK, docs updated.

> 2) There's an extra space, which breaks \pset border 2
>
> 717c717
> < fputc(' ', fout);;
> ---
> > fputc(' ', fout);
> 842c842
> < fputs(" | ", fout);
> ---
> > fputs(" |", f

OK, got them fixed.

> 2) With \pset border 2, the far left border, for symmetry, should work
> like the middle borders.

OK, how does it look now with this patch?

> 3) I'm getting bolder: how about having \pset format wrapped as the
> default? Any downsides?

I think we are going to want it as the default for many psql
informational commands, like \df. Not sure about a more general
default. We were just discussing using \x as a default for wide output
but it seems this wrap style is probably a better solution than
switching for \x for wide columns (less distracting for the user and
cleaner). That will have to be a separate discussion once we are done.

Oh, I found a problem in my coding of the new wrap function I added.
While I handled the case where a character might span multiple bytes, I
assumed all characters had a display width of one. You can see from
pg_wcsformat()'s use of PQdsplen() that this isn't always the case. I
have modified the patch to properly use PQdsplen() but we are going to
need multi-byte users to test this once we are done.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

Attachment Content-Type Size
/pgpatches/wrap text/x-diff 32.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2008-04-21 15:38:58 Re: Commitfest namespacing (was: TODO, FAQs to Wiki?)
Previous Message Chris Browne 2008-04-21 15:25:38 Re: TODO, FAQs to Wiki?

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2008-04-21 15:40:17 Re: Testing pg_terminate_backend()
Previous Message Bruce Momjian 2008-04-21 15:19:03 Re: Proposed patch - psql wraps at window width