help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] read -ep and ANSI colour sequences


From: Pierre Gaston
Subject: Re: [Help-bash] read -ep and ANSI colour sequences
Date: Wed, 20 Feb 2013 17:29:01 +0200

On Wed, Feb 20, 2013 at 5:24 PM, Chet Ramey <address@hidden> wrote:
> On 2/20/13 6:44 AM, Pierre Gaston wrote:
>
>> I mean in PS1 you should surround the terminal codes with \[  \] so
>> that readline can calculate the length of the prompt correctly.
>
> read -ep $'\001\033[1m\002ABC\001\033[0m\002' value
>
> will do the right thing on the particular terminal (emulator) the
> original poster is using.

Great thanks.
Maybe this could make its way in the bash documentation?

It's also useful for people using functions to generate their prompts
since you can print \1 \0 from the function
(whereas printing \[  \] doesn't work)

We see this kind of things from time to time on #bash on freenode



reply via email to

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