Im reopening this because with bash 3.2-0ubuntu18 im having this same problem.
Recipe written by Björn Lindqvist wrote on 2007-06-30 still breaks bash color prompt:
1. Set PS1="\033[01;37m[ \[\033[01;34m\]\w\[\033[00m\] \033[01;37m]\n\$\033[00m "
2. Type "foo bar baz"
3. Press ctrl+a
3. Cursor should jump back to the beginning of the line, but instead jumps back to "foo b." This is how it looks like with "_" being the cursor:
Im reopening this because with bash 3.2-0ubuntu18 im having this same problem.
Recipe written by Björn Lindqvist wrote on 2007-06-30 still breaks bash color prompt:
1. Set PS1="\033[01;37m[ \[\033[ 01;34m\ ]\w\[\033[ 00m\] \033[01; 37m]\n\ $\033[00m "
2. Type "foo bar baz"
3. Press ctrl+a
3. Cursor should jump back to the beginning of the line, but instead jumps back to "foo b." This is how it looks like with "_" being the cursor:
foo b_ar baz