1

When using tmux, I have issues of ghost characters when using the Up and Down arrow keys in Bash. If I press UpArrow a few times and then press DownArrow a few times, then the first few characters of a previous command remain on the Bash line.

For instance, take this clean Bash line:

$

Now I press UpArrow three times:

$ ls /home/dotancohen/Downloads

Now I press DownArrow three times:

$ ls /home/do

I can reproduce the issue with no ~/.tmux.conf file, after exiting and restarting tmux. How should I diagnose this?

Edit: Here is my $PS1:

$ echo $PS1
\[\] - \h():\W$ \[\]

Note that everything from the second backslash up until the last close bracket is green. This function creates the prompt:

PROMPT_COMMAND=$(
    cat<<-'EOF'

    retval=$?

    RED=$(tput setaf 1)
    GREEN=$(tput setaf 2)
    STOP=$(tput sgr0)

    c=0
    for i in $retval ${PIPESTATUS[@]}; do ((c += $i)); done

    if (($c == 0)); then
        PS1="\[$GREEN\] - \h(${WINDOW}):\W$ \[$STOP\]"
    else
        PS1="\[$RED\] - \h(${WINDOW}):\W$ \[$STOP\]"
    fi
EOF
)
1
  • 1
    Put the result of echo $PS1 into your question.
    – JdeBP
    Mar 2, 2014 at 11:14

1 Answer 1

0

This is, of course, the same problem and the same cause as at https://superuser.com/a/695350/38062 . In this particular case, the non-spacing escape sequence that you've forgotten to delimit with \[ and \], and that is banjanxing bash, is apparently somewhere in the expansion of ${WINDOW}.

0

Not the answer you're looking for? Browse other questions tagged .