[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] color in bash read builtin prompt
From: |
Geir Hauge |
Subject: |
Re: [Help-bash] color in bash read builtin prompt |
Date: |
Mon, 20 Oct 2014 07:23:47 +0200 |
2014-10-20 4:20 GMT+02:00 Clark Wang <address@hidden>:
> On Fri, Oct 17, 2014 at 8:50 PM, Geir Hauge <address@hidden> wrote:
>>
>> Also needs \1 and \2 around the non-printable bytes
>>
>
> Hi Geir,
>
> What does \1 and \2 here means? Is there a tput command used to get them?
>
It's a somewhat undocumented feature of readline. There are two defines
in readline.h [1]:
/* Definitions available for use by readline clients. */
#define RL_PROMPT_START_IGNORE '\001'
#define RL_PROMPT_END_IGNORE '\002'
Last time this came up, Chet explained that the \[ and \] of PS1 get
translated to those before being passed to readline.
[1]
http://git.savannah.gnu.org/cgit/bash.git/tree/lib/readline/readline.h?id=ca6a2ba40c709c2b45a56e49d21d0dfc66e21974#n833
--
Geir Hauge