readline clash with bash/PS1 escapes

Suan Yong suan@cs.wisc.edu
Wed Aug 24 19:08:00 GMT 2005


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;\W007円\]\[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/


More information about the Cygwin mailing list

AltStyle によって変換されたページ (->オリジナル) /