[Top][All Lists]

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

Re: bad interaction with custom prompt and beginning-of-line

From: Brian Mathis
Subject: Re: bad interaction with custom prompt and beginning-of-line
Date: Fri, 04 May 2007 19:10:49 -0400
User-agent: Thunderbird (Windows/20070221)

Your prompt doesn't appear to be formatted correctly.  At a quick glance, it looks like you are starting the prompt with a "non printing" escape sequence (\[) for bash, but you never close it.  Take a look at the bash man page, specifically do a search for "begin a sequence of non-printing characters" under the PROMPTING section.

Each of your color codes should be enclosed in that type of a sequence.

Robert Anderson wrote:
I use bash and have a custom prompt that includes some coloring (which includes non-printing characters, of course).

When in an xterm, I can always use ctrl-a (beginning-of-line) to return to the beginning of the line, and it always goes to the correct cursor position.

When I start screen, if I have text that wraps onto more than one line, and I use ctrl-a, it backs up too far, into the middle of the prompt.  If cursor forward, the prompt is overwritten by the text as if it was shifted left a few characters.

Is there any way I can work around this, other than removing the non-printing characters from my prompt?

Here's an example prompt you can try:

PS1="\[\e[0;42m\u\e[0;49m\] "

which is just your username in green followed by a space.  Try typing a line that wraps, and then do beginning-of-line.

I am using screen 4.0.2.

Thanks for any help,

_______________________________________________ screen-users mailing list address@hidden

reply via email to

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