On Thu, Apr 20, 2000 at 02:57:31PM +0100, Niall wrote:
> export PS1="\u@\h:\w >\e]2;\u@\h:\w^G"
>> This seems to be upsetting bash, in that when I enter a command such that
> the length of the displayed prompt string in the shell + the command becomes
> longer than 50 odd characters, bash sends a carriage return to the terminal.
> You can carry on typing, and as long as you don't get too confused, you can
> work away. This seems to be a bash problem, in that it happens in an xterm,
> an rxvt and a konsole.
>> Any ideas, or is it bashbug time ?
It's definitely not a bug. In order to properly format the line as you edit
it, the readline library needs to keep track of the cursor position. To
do this, it needs to know the length of the prompt string.
However, readline cannot know that some of the prompt is non-printing. (To
figure this out would require very intimate knowledge of a million different
IIRC, there is a special marker that you can stick into a prompt string
to delimit the portion that is non-printing, so readline knows to ignore
it. Let's have a look at the bash man page...
$ man bash
When executing interactively, bash displays the primary prompt PS1 when it is ready to read
\[ begin a sequence of non-printing characters, which could be used to embed a
terminal control sequence into the prompt
\] end a sequence of non-printing characters
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!