On Sat, Jun 10, 2017 at 06:49:13PM +0200, Paul Peet wrote: > declare -- PS1="\\[\\e]0;\\u@\\h: > \\w\\a\\]\${debian_chroot:+(\$debian_chroot)}\\[\\033[01;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\\$ > " [...] > > Bash relies on \[ and \] to determine how much space is occupied by the > > prompt when it is to be redrawn, so in this case it thinks the prompt is 2 > > columns wider than it actually is.
George already said it. There are two types of characters inside the prompt string, visible and invisible. Color sequences are of the invisible kind (these have an effect on the terminal, but do not occupy any space on the line). You must wrap invisible character sequences with \[ and \], otherwise Readline's calculation to figure out the physical lenght of your prompt string will be off, and will cause the effect that you're experiencing. Try with: # vvvvv- this is an invisible sequence. PS1='\[\e]0;\]\u@\h:\w\a\$...' # ^ ^ instead. -- Eduardo Bustamante https://dualbus.me/