I'm using PuTTY to log into a Debian server. I have this odd problem that when a command I'm typing gets too long, it doesn't wraparound and start a new line. Instead, it starts at the beginning of the same line and starts to overwrite the prompt and then the beginning of the command.
The command will run just fine, but it is really annoying, I'm assuming there is some setting that would fix this for me?
I've just solved this myself.
It was just some color escapes in the PS1 command prompt:
LTGREEN="\033[40;1;32m"
LTBLUE="\033[40;1;34m"
CLEAR="\033[0m"
LIGHT_GRAY="\033[40;1;33m"
export PS1="$LTGREEN\u$LTBLUE@\h:$LIGHT_GRAY\w$CLEAR ❯ "
The issue is that the color literals are not enclosed in brackets. Placing escaped brackets around them fixes the issue entirely:
LTGREEN="\[\033[40;1;32m\]"
LTBLUE="\[\033[40;1;34m\]"
CLEAR="\[\033[0m\]"
LIGHT_GRAY="\[\033[40;1;33m\]"
export PS1="$LTGREEN\u$LTBLUE@\h:$LIGHT_GRAY\w$CLEAR ❯ "
Hope this helps.