This is the mail archive of the
cygwin
mailing list for the Cygwin project.
readline clash with bash/PS1 escapes
- From: Suan Yong <suan at cs dot wisc dot edu>
- To: cygwin at cygwin dot com
- Date: Wed, 24 Aug 2005 14:07:54 -0500 (CDT)
- Subject: readline clash with bash/PS1 escapes
Hi,
After a recent cygwin update (including one just today), I'm seeing a bug
in the readline completion that I finally tracked down to the control
sequences in my PS1 for setting the title bar and coloring my prompt. It
looks like the '\[' and '\]' delimeters are screwing it up. Here are the
symptoms (~> is my prompt).
~>env | fgrep PS1
PS1=\[\033]0;\W\007\]\[\033[32m\]\w>\[\033[0m\]
When I type: ls .<tab><tab>
I see:
----------------------------
~>ls .
./ .bash_history .cvsrc .ssh/ .vimrc
../ .bash_profile .history .vim/
.Xdefaults .bashrc .inputrc .viminfo
~>ls . .
----------^-----------------
Notice the extra " ." in the re-rendered line (^ indicates the prompt
position). Something is clearly out of sync.
For example, if I then type: Control-U
I see:
----------------------------
~>ls .
./ .bash_history .cvsrc .ssh/ .vimrc
../ .bash_profile .history .vim/
.Xdefaults .bashrc .inputrc .viminfo
~>ls
----^-----------------------
where the prompt is overlapping the "ghost" letters "ls", which aren't
really in the buffer. E.g., if I then type: p<enter>
I see:
----------------------------
~>ls .
./ .bash_history .cvsrc .ssh/ .vimrc
../ .bash_profile .history .vim/
.Xdefaults .bashrc .inputrc .viminfo
~>ps
bash: p: command not found
~>
----^-----------------------
After some experimentation, I found that if I removed the '\[' and '\]'
delimiters from my PS1, the errant behavior goes away. The
control sequences evidently still work, even though the man page for bash
suggests that they really should be enclosed within \[ \].
Suan
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/