Here's my ps1 variable:
export PS1='\e[33;1m\u@\h\]: \e[31m\W\e[0m\e[0;32m$(parse_git_branch)\e[0m$\] '
Where parse_git_branch
is a function that shows what branch I'm currently on in git, such as (master).
I've also set this in my .bashrc
stty columns 500
The behavior is really weird - in VS code if I make my integrated terminal really small, the line wrapping works correctly. If it's above a certain size, it starts overwriting itself on the same line.
Any idea what I'm doing wrong?
edit
Ben was correct below - I had to make sure the escape characters matched up and wrapped the entire thing in brackets. This seems to work:
export PS1='\[\e[33;1m\u@\h\]: \e[31m\W\e \e[0;32m$(parse_git_branch)\] \]\e[0m$\]\] \]'