bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PS0 issue with escape sequence


From: Benoît Dejean
Subject: Re: PS0 issue with escape sequence
Date: Sat, 17 Sep 2016 23:24:32 +0200
User-agent: Mutt/1.5.20 (2009-12-10)

On Sat, Sep 17, 2016 at 04:57:08PM -0400, Chet Ramey wrote:
> On 9/17/16 4:47 PM, Benoît Dejean wrote:
> > On Sat, Sep 17, 2016 at 01:12:24PM -0400, Chet Ramey wrote:
> >> On 9/16/16 9:25 PM, Ben wrote:
> >>> Hello,
> >>>
> >>> using bash-4.4, setting PS0 to '\[\033[1;36m\]started at
> >>> \t\[\033[0m\]\n' makes it output PS0 with a non-printable \x01\x02
> >>> prefix and suffix.
> >>
> >> Yes, those are the expansions of the \[ and \] escape sequences.  Since
> >> $PS0 is not being passed to readline for display, you probably don't need
> >> to include those escape sequences at all.
> > 
> > Would you consider enabling it ? The usage is obvious: display time of
> > start and end of a command, with a different color/etc.
> 
> I think you misunderstood what I meant.  The reason to include the \[ and
> \] escape sequences is so readline knows that the enclosed characters don't
> display on the screen.  Since PS0 is not expanded or used by readline (the
> usual set of escape sequences gets expanded and the result is printed with
> fprintf()), you can include the color sequences without worrying about
> needing \[ and \].

OK, understood. Thank you.

-- 
Benoît Dejean



reply via email to

[Prev in Thread] Current Thread [Next in Thread]