Terminal line wrap bug

2008-07-28 by Bluewind

The line wrap (in every terminal) doesn't work correctly once you have color codes in your PS1.

Most site give you codes like \e[0;31m, but sadly these codes ruin the line wrap so after some letters your cursor jumps to the beginning of the very line it is on and overwrites your PS1. Once this line is full it jumps to the next line as it is supposed to.

Thanks to the Archlinux Forums I finally found a way to fix it. The fixed version of the code mentioned earlier is \[\e[0;31m\].

But if you have a function in the .bashrc you should not use those codes as they will cause some backslashes in the output.