The question closely follows this one, except that I did what the git-prompt.sh does myself.
However, I started noticing weird rendering issues, where long lines do not wrap on the next console line, but rather override the starting of the same line, much like as \r was appended to the $PS1 sequence which brings the cursor at beginning of the line.
Moreover, if I undo the command with up arrow, then current line (the one we were about to write the too-long command, overridden) gets completely removed.
Attached a screenshot of what I am referring to.
However, there's no trace of such CR character anywhere in the PS1 string.
I tested with the git-prompt.sh, and see the same result.
It is definitely something messing with the PS1 string, since if I do not set it and let the default [\u@\h \W]\$, then the issue disappears.
The modified PS1 string is:
\[\e]0;[\u@\h] \w\a\][\[\[\033[01;31m\]\]\u@\h\[\033[00m\] \[\033[01;34m\]\w\[\033[00m\] (\[\033[01;33m\]main\[\033[00m\])]\$
Any ideas?

PS1, not just the value you think is being assigned.TERMvariable?PS1="${_ps1_str}$(__git_branch)]\$ "where the first variable is the string you see + the branch part if it exists. I do save the original one before modifying it.typeset -p PS1should generate an assignment statement that leaves no doubt as to what's in the variable; it also gives us something we can cut-n-paste into our environments without the need to have an environment that looks exactly like yours, eg, no need to reproduce_ps1_strand__git_branch