Re: [PATCHES] [PATCH] Formatting patch for psql

2005-11-25 Thread Martijn van Oosterhout
On Fri, Nov 25, 2005 at 11:08:45AM -0500, Tom Lane wrote: > Martijn van Oosterhout writes: > > Would people prefer a patch that brought the libpq routines up to > > scratch and have mbprint use that? > > I would. ACK. Will look into it. -- Martijn van Oosterhout http://svana.org/kleptog/ >

Re: [PATCHES] [PATCH] Formatting patch for psql

2005-11-25 Thread Tom Lane
Martijn van Oosterhout writes: > Would people prefer a patch that brought the libpq routines up to > scratch and have mbprint use that? I would. regards, tom lane ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmast

Re: [PATCHES] [PATCH] Formatting patch for psql

2005-11-25 Thread Martijn van Oosterhout
On Fri, Nov 25, 2005 at 09:58:21AM -0500, Tom Lane wrote: > Martijn van Oosterhout writes: > > ... There is a fair > > bit of encoding code in there already but the information you need here > > is specifically: is this char a control character and in particular, is > > it a newline. > > The appr

Re: [PATCHES] [PATCH] Formatting patch for psql

2005-11-25 Thread Tom Lane
Martijn van Oosterhout writes: > ... There is a fair > bit of encoding code in there already but the information you need here > is specifically: is this char a control character and in particular, is > it a newline. The appropriate test for that is just "ch == '\n'", in all the encodings we supp

Re: [PATCHES] [PATCH] Formatting patch for psql

2005-11-25 Thread Martijn van Oosterhout
On Thu, Nov 24, 2005 at 09:23:55PM -0500, Tom Lane wrote: > Martijn van Oosterhout writes: > > And what I'm saying is that you can only do that if all single byte > > encodings are ASCII compatable and I'm not prepared to say that... > > psql already assumes that; see the flex processor. Hmm, Ok

Re: [PATCHES] [PATCH] Formatting patch for psql

2005-11-24 Thread Tom Lane
Martijn van Oosterhout writes: > And what I'm saying is that you can only do that if all single byte > encodings are ASCII compatable and I'm not prepared to say that... psql already assumes that; see the flex processor. > So in the switch statement I listed the encodings I know to be ASCII > co

Re: [PATCHES] [PATCH] Formatting patch for psql

2005-11-24 Thread Martijn van Oosterhout
On Thu, Nov 24, 2005 at 11:35:11PM +0100, Peter Eisentraut wrote: > Martijn van Oosterhout wrote: > > On Thu, Nov 24, 2005 at 03:45:12PM +0100, Peter Eisentraut wrote: > > > Shouldn't you use PQmblen() to determine whether an encoding is > > > single-byte, rather than having an enumerated list? > >

Re: [PATCHES] [PATCH] Formatting patch for psql

2005-11-24 Thread Peter Eisentraut
Martijn van Oosterhout wrote: > On Thu, Nov 24, 2005 at 03:45:12PM +0100, Peter Eisentraut wrote: > > Shouldn't you use PQmblen() to determine whether an encoding is > > single-byte, rather than having an enumerated list? > > Actually, thinking about it the answer is no. The code is relying on > th

Re: [PATCHES] [PATCH] Formatting patch for psql

2005-11-24 Thread Martijn van Oosterhout
On Thu, Nov 24, 2005 at 03:45:12PM +0100, Peter Eisentraut wrote: > Shouldn't you use PQmblen() to determine whether an encoding is > single-byte, rather than having an enumerated list? Actually, thinking about it the answer is no. The code is relying on the fact that it's a charset that has ASCI

Re: [PATCHES] [PATCH] Formatting patch for psql

2005-11-24 Thread Martijn van Oosterhout
On Thu, Nov 24, 2005 at 03:45:12PM +0100, Peter Eisentraut wrote: > Martijn van Oosterhout wrote: > > Here is my patch to make psql handle multi-line output sanely. > > Instead of embedded newlines splattering your output across the > > screen, everything gets indented to the right column. > > Sho

Re: [PATCHES] [PATCH] Formatting patch for psql

2005-11-24 Thread Peter Eisentraut
Martijn van Oosterhout wrote: > Here is my patch to make psql handle multi-line output sanely. > Instead of embedded newlines splattering your output across the > screen, everything gets indented to the right column. Shouldn't you use PQmblen() to determine whether an encoding is single-byte, rat

[PATCHES] [PATCH] Formatting patch for psql

2005-11-17 Thread Martijn van Oosterhout
Hi, Here is my patch to make psql handle multi-line output sanely. Instead of embedded newlines splattering your output across the screen, everything gets indented to the right column. It basically works by extending the *_width functions to instead work out the estimate width, height and formatt