screen-users
[Top][All Lists]
Advanced

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

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


From: Robert Anderson
Subject: Re: bad interaction with custom prompt and beginning-of-line
Date: Fri, 4 May 2007 16:39:28 -0700


Well, sort of.  I did close it, but in the wrong place.  \[\] must enclose non-printing characters and *only* non-printing characters.  I was taking \[\] to mean "this prompt may include non-printing characters."  With that straightened out, it now works as expected.

Thank you.

On 5/4/07, Brian Mathis <address@hidden> wrote:
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,
Bob


_______________________________________________
screen-users mailing list
address@hidden http://lists.gnu.org/mailman/listinfo/screen-users


reply via email to

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