I'm colorizing parts of my bash prompt using ANSI escape sequences. This works great, until the command I'm currently typing in is long enough that it has to wrap. Instead of the rest of the command displaying on the next line, it wraps back to column 1 of the current line, overwriting the beginning of the prompt.
I get that behavior with this prompt:
export PS1="[\u][\033[0;32;40mdemo \033[0;33;40m1.5.40.b\033[0;37;40m] \w> \033[0m"
but it works correctly with the same prompt, ANSI sequences remove:
export PS1="[\u][demo 1.5.40.b] \w> "
I'm connecting using the current version of Putty, with default Putty settings. The OS is Ubuntu 8.10.