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
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 existing "if (visible)" instead
> of making a new top-level c
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
Hi,
I noticed that this patch does not work when PROMPT1 contains a new line,
since the whole length of PROMPT1 is taken into account for the length of
%w.
Attached screenshot shows the issue on my psql, with the following PROMPT
variables (colors edited out for readability):
\set PROMPT1 '\n[pid
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.
On Tue, Nov 19, 2019 at 6:21 AM Tom Lane wrote:
> Thomas Munro writes:
> > Yeah. Maybe pg_wcswidth() would be OK though, and it's available in
> > psql, though I guess you'd have to make a copy with the escaped bits
> > stripped out.
>
> Right, you should use pg_wcswidth() or the underlying PQds
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
On Fri, Nov 15, 2019 at 3:58 AM Tom Lane wrote:
> 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 fr
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
23 matches
Mail list logo