[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug in escape sequences on the prompt
From: |
Francis Montagnac |
Subject: |
Re: Bug in escape sequences on the prompt |
Date: |
5 Mar 2001 11:41:53 GMT |
In article <Pine.GSO.4.21L.0103042243290.8658-100000@unix15.andrew.cmu.edu>,
flung@andrew.cmu.edu (Fei Lung) writes:
>Description:
> When using bash in either console, screen, or an xterm, there is a
>problem with using the escape sequences in PS1. If there are any escape
>sequences, then commands typed past the end of the line will not continue
>on the next. It will overwrite the current line. Tested on bash 1.14,
>2.03, 2.04
It's in the FAQ:
E3) When I have terminal escape sequences in my prompt, why does bash
wrap lines at the wrong column?
Readline, the line editing library that bash uses, does not know
that the terminal escape sequences do not take up space on the
screen. The redisplay code assumes, unless told otherwise, that
each character in the prompt is a `printable' character that
takes up one character position on the screen.
You can use the bash prompt expansion facility (see the PROMPTING
section in the manual page) to tell readline that sequences of
characters in the prompt strings take up no screen space.
Use the \[ escape to begin a sequence of non-printing characters,
and the \] escape to signal the end of such a sequence.
--
Francis.Montagnac@sophia.inria.fr, Tel: (33)04 92 38 79 11
INRIA Sophia, 2004, rte des Lucioles, B.P.93 - 06902 Sophia Antipolis Cedex