Sorry, I think it's a problem not worth solving; it's helpful to know this has occurred by the state the screen is in. If you want to solve it correctly then, since it's also common to have the cursor left bereft in the middle of a screen of text,
PS1='\['"$(tput cr)$(tput ed)"'\]$ '
is better since it clears to the end of the screen, e.g. try
seq 1000 | fmt; tput cup 10 20
with and without it.
But the thing is, with either that approach or the one in the article, you're wiping out what may be useful; that unfinished line causing PS1 to be pushed along may have vital data on it, data that's hard to re-create.
But the thing is, with either that approach or the one in the article, you're wiping out what may be useful; that unfinished line causing PS1 to be pushed along may have vital data on it, data that's hard to re-create.