On Mon, Dec 23, 2019 at 5:43 AM Maxence Ahlouche
wrote:
> On Wed, 27 Nov 2019 at 17:09, Tom Lane wrote:
>> Good idea, but I think you need to account for "visible" (ie, if the
>> newline is inside RL_PROMPT_START_IGNORE, it shouldn't change the width).
>> It might be best to add logic inside the
ould concatenate with a tab?), but I'm not sure it's worth the
effort.
commit 491cf173aad247299622796775feea580a8f9b13 (HEAD -> refs/heads/patch_psql_prompt)
Author: Maxence Ahlouche
Date: Wed Nov 27 16:21:35 2019 +0100
Fix %w length in PROMPT2 when PROMPT1 contains a newline, in psql.
The width o
Maxence Ahlouche writes:
> The length of %w should probably be computed starting from the last newline
> in PROMPT1.
Good idea, but I think you need to account for "visible" (ie, if the
newline is inside RL_PROMPT_START_IGNORE, it shouldn't change the width).
It might be best to add logic inside
it's a start.
Otherwise, nice feature, I like it!
Regards,
Maxence
commit 7fca5709d3ada8cf0b4219c707562cd841c997d2 (HEAD -> refs/heads/psql_prompt)
Author: Maxence Ahlouche
Date: Wed Nov 27 16:21:35 2019 +0100
Fix %w length in PROMPT2 when PROMPT1 contains a newline, in psql.
On Tue, Nov 19, 2019 at 04:02:48PM +1300, Thomas Munro wrote:
> On Tue, Nov 19, 2019 at 12:09 PM Tom Lane wrote:
> > You should follow the logic in pg_wcswidth: compute PQmblen() first,
> > and bail out if it's more than the remaining string length, otherwise
> > it's ok to apply PQdsplen().
>
>
On Tue, Nov 19, 2019 at 12:09 PM Tom Lane wrote:
> You should follow the logic in pg_wcswidth: compute PQmblen() first,
> and bail out if it's more than the remaining string length, otherwise
> it's ok to apply PQdsplen().
Got it. I was worried that it wasn't safe to call even PQmblen(),
because
Thomas Munro writes:
> Right, a PQdsplen()/PQmblen() loop works nicely, as attached.
> I spotted a potential problem: I suppose I could write a PROMPT1 that
> includes an invalid multibyte sequence at the end of the buffer and
> trick PQmblen() or PQdsplen() into reading a few bytes past the end.
coding_max_length() to make sure
you can't get close enough to the end of the buffer, but neither of
those functions are available to psql.
v2-0001-Allow-invisible-PROMPT2-in-psql.patch
Description: Binary data
Thomas Munro writes:
> On Mon, Nov 18, 2019 at 1:49 PM Alvaro Herrera
> wrote:
>> On 2019-Nov-18, Thomas Munro wrote:
>>> Nice idea. Here's one like that, that just does the counting at the
>>> end and looks out for readline control codes. It's pretty naive about
>>> what "width" means though:
On Mon, Nov 18, 2019 at 1:49 PM Alvaro Herrera wrote:
> On 2019-Nov-18, Thomas Munro wrote:
> > Nice idea. Here's one like that, that just does the counting at the
> > end and looks out for readline control codes. It's pretty naive about
> > what "width" means though: you'll get two spaces for U
On 2019-Nov-18, Thomas Munro wrote:
> Nice idea. Here's one like that, that just does the counting at the
> end and looks out for readline control codes. It's pretty naive about
> what "width" means though: you'll get two spaces for UTF-8 encoded é,
> and I suppose a complete implementation woul
g at the
end and looks out for readline control codes. It's pretty naive about
what "width" means though: you'll get two spaces for UTF-8 encoded é,
and I suppose a complete implementation would know about the half
width/full width thing for Chinese and Japanese etc.
0001-Allow-invisible-PROMPT2-in-psql.patch
Description: Binary data
Kyotaro Horiguchi writes:
> This seems assuming %x are a kind of stable (until semicolon)
> function. But at least %`..` can be volatile. So, I think the %w
> thing in PROMPT2 should be able to refer the actual prompt string
> resulted from PROMPT1.
Oh, that's a good point. But it actually lead
At Wed, 13 Nov 2019 20:57:04 +0100, David Fetter wrote in
> On Wed, Nov 13, 2019 at 03:58:38PM -0300, Alvaro Herrera wrote:
> > On 2019-Nov-13, David Fetter wrote:
> >
> > > On Wed, Nov 13, 2019 at 03:06:08PM -0300, Alvaro Herrera wrote:
> > > > On 2019-Nov-13, David Fetter wrote:
> > > >
> > >
On Wed, Nov 13, 2019 at 03:58:38PM -0300, Alvaro Herrera wrote:
> On 2019-Nov-13, David Fetter wrote:
>
> > On Wed, Nov 13, 2019 at 03:06:08PM -0300, Alvaro Herrera wrote:
> > > On 2019-Nov-13, David Fetter wrote:
> > >
> > > > On Wed, Nov 13, 2019 at 09:47:01AM -0500, Tom Lane wrote:
> > >
> >
On 2019-Nov-13, David Fetter wrote:
> On Wed, Nov 13, 2019 at 03:06:08PM -0300, Alvaro Herrera wrote:
> > On 2019-Nov-13, David Fetter wrote:
> >
> > > On Wed, Nov 13, 2019 at 09:47:01AM -0500, Tom Lane wrote:
> >
> > > > > How about a circumfix directive (like the existing %[ ... %])
> > > > >
On Wed, Nov 13, 2019 at 03:06:08PM -0300, Alvaro Herrera wrote:
> On 2019-Nov-13, David Fetter wrote:
>
> > On Wed, Nov 13, 2019 at 09:47:01AM -0500, Tom Lane wrote:
>
> > > > How about a circumfix directive (like the existing %[ ... %])
> > > > that replaces everything inside with whitespace, bu
On 2019-Nov-13, David Fetter wrote:
> On Wed, Nov 13, 2019 at 09:47:01AM -0500, Tom Lane wrote:
> > > How about a circumfix directive (like the existing %[ ... %])
> > > that replaces everything inside with whitespace, but keeps the width?
> >
> > Or just define %w as meaning "whitespace of the
On 11/13/19 12:49 PM, David Fetter wrote:
>> Or just define %w as meaning "whitespace of the same width as
>> PROMPT1". You couldn't use it *in* PROMPT1, then, but I see
>> no use-case for that anyway.
>
> +1 for doing it this way. Would it make more sense to error out if
> somebody tried to set
On Wed, Nov 13, 2019 at 09:47:01AM -0500, Tom Lane wrote:
> ilm...@ilmari.org (Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker?=) writes:
> > Thomas Munro writes:
> >> From the advanced bikeshedding department: I'd like my psql
> >> transcripts to have the usual alignment, but be easier to copy and
> >> p
ilm...@ilmari.org (Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker?=) writes:
> Thomas Munro writes:
>> From the advanced bikeshedding department: I'd like my psql
>> transcripts to have the usual alignment, but be easier to copy and
>> paste later without having weird prompt stuff in the middle. How
>>
Thomas Munro writes:
> Hello hackers,
>
> From the advanced bikeshedding department: I'd like my psql
> transcripts to have the usual alignment, but be easier to copy and
> paste later without having weird prompt stuff in the middle. How
> about a prompt format directive %w that means "whitespac
st 13. 11. 2019 v 4:15 odesílatel Thomas Munro
napsal:
> Hello hackers,
>
> From the advanced bikeshedding department: I'd like my psql
> transcripts to have the usual alignment, but be easier to copy and
> paste later without having weird prompt stuff in the middle. How
> about a prompt format
Hello hackers,
>From the advanced bikeshedding department: I'd like my psql
transcripts to have the usual alignment, but be easier to copy and
paste later without having weird prompt stuff in the middle. How
about a prompt format directive %w that means "whitespace of the same
width as %/"? Then
24 matches
Mail list logo