I have an issue where if I type in very long commands in bash the terminal will not render what I'm typing correctly. I'd expect that if I had a command like the following:
username@someserver ~/somepath $ ssh -i /path/to/private/key
[email protected]
The command should render on two lines. Instead it will often wrap around and start writing over the top of my prompt, somewhat like this:
[email protected] -i /path/to/private/key
If I decide to go back and change some argument there's no telling where the cursor will show up, sometimes in the middle of the prompt, but usually on the line above where I'm typing.
Additional fun happens when when I Up to a previous command. I've tried this in both gnome-terminal and terminator and on i3 and Cinnamon. Someone suggested it was my prompt, so here that is:
\[\033[01;32m\]\u:\[\033[01;34m\] \W\033[01;34m \$\[\033[00m\]
Ctrll, reset
, and clear
all do what they say, but when I type the command back in or Up the same things happens.
I checked and checkwinsize
is enabled in bash. This happens on 80x24 and other window sizes.
Is this just something I learn to live with? Is there some piece of magic which I should know? I've settled for just using a really short prompt, but that doesn't fix the issue.
env -i bash --norc
fixes it. The $COLUMNS and $LINES match. Does that mean that there's something funny with my .bashrc?\[\033[01;32m\]\u: \[\033[01;34m\]\W \[\033[01;34m\] \$ \[\033[0m\]
seems to avoid the weirdness in the behavior - but don't know if it respects your original prompt completely...tput smam