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

Re: Colorized Prompts Problem



I do like to use a colorized promt to show my running jobs and whether my AWS creds are in the environment, but I usually use the built in PS2 rather than create insanely long lines. It took a while to develop that habit, though, but it works better. You can of course break lines arbitrarily with a "\"

Tim Kelley


On Fri, May 1, 2015 at 10:39 AM, Eduardo M KALINOWSKI <eduardo@kalinowski.com.br> wrote:
On 05/01/2015 12:07 PM, Thomas H. George wrote:
> I entered the following in .bashrc
>
>    PS1='\033[01;33m\h:\w\$ \033[00m'
>
> to colorize the prompt (very handy to find the prompt when a command
> fills the console screen with lines of text)
>
> The only problem occurs when the next entry is more than one line.  In
> that case the entry wraps around without moving to a new line. Instead
> it overwrites the begining of the current line. The command will still
> work but cannot be revised in the case of a typo.
>
> For example the prompt alone may be almost a line long, the \w means it
> will contain the full path to the current directory.  The next command
> to be entered is a long one that should wrap to a new line but instead
> begins to overwrite the directory path. You see you made a typo and try
> to move back with the left arrow key and instead the cursor jumps to the
> line above.
>
> Admittedly this is an infrequent and not a serious problem. Still it is
> annoying when it occurs. Have I made an error in the colorizing prompt?

The bash manpage suggests enclosing the non-printing escape sequences
inside \[ and \]. This is not 100% effective, but it helps.


--
Eduardo M KALINOWSKI
eduardo@kalinowski.com.br


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: [🔎] 55439E1B.2010404@kalinowski.com.br" target="_blank">https://lists.debian.org/[🔎] 55439E1B.2010404@kalinowski.com.br



Reply to: