bug-bash
[Top][All Lists]
Advanced

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

colored bash prompts seem to confuse readline


From: Britton Kerin
Subject: colored bash prompts seem to confuse readline
Date: Tue, 09 Feb 2010 08:39:49 -0900

Well ok its not just a plain colored prompt, what I would like to use is
this:

    txtred='\e[0;31m' # Red
    bldgrn='\e[1;32m' # Green
    txtrst='\e[0m'    # Text Reset
    PROMPT_COMMAND=' \
        if [ $? -eq 0 ]; then \
            PROMPT_PREFIX="$txtred"; \
        else \
            PROMPT_PREFIX="$bldgrn$? "; \
        fi '

    PS1='$(echo -ne "$PROMPT_PREFIX")'"\$\[$txtrst\] "

This is basically taken from
http://wiki.archlinux.org/index.php/Color_Bash_Prompt and the
version there seems to have the same problems.

This is worthwhile craziness I think as it makes the normal prompt
unobtrusive and the
commands and output easy to see, while still making prompt lines easily
distinguishable
in the scrollback.  And commands that error are easily seeable.  And
when using wild
weird grammar you don't have to continually type '|| echo yip' to
everything to see if it works.
And it uses green for 'fail' and red for 'succeed' in keeping with the
shell's zero-is-true
approach to life.

But unfortunately it somehow causes readline to get confused, I think. 
When doing things
like up arrow or reverse search part of some old commands seem to get
stuck as a prefix in
what is displayed, though the command works find when found.  Also,
multiline commands don't
seem to work right (it wraps back over the same line).

Britton






reply via email to

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