When holding k
or holding up
, previously entered commands are shown, but at some point, the first 10 characters of a command longer than 10 characters stay. This is not always the first command longer than 10 characters encountered, but pressing ctrl+c
and holding up
again causes the same characters to stay.
$ echo test
test
$ echo thisisalongstring
thisisalongstring
# pressing `up` twice
$ echo thisiecho test # should be `echo test`
test
# even though `echo thisi` is shown, it is not executed
Is there a way to fix this?
I didn't change anything in ~/.bashrc
(except appending PS1='test '
for testing).
# this is the default ubuntu prompt
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
- This happens both in gnome-terminal and konsole.
- I tried appending
PS1='test '
andPS1=''
to~/.bashrc
, which contain no non-printable characters, but this still happens. - Executing
PS1=$PS1
orPS1=$(echo $PS1)
doesn't work. - Manually pasting the code above into the terminal solves this problem, but I have no idea why.
- Echoing
$PS1
after launching the terminal yields the same result as echoing$PS1
after manually pasting. - Executing
. ~/.bashrc
causes the prompt to revert to being bugged.
- Echoing
This question sounds similar to the already solved Why is my bash prompt getting bugged when I browse the history?, but this also happens when no non-printable characters are present in PS1
.