This here tries to address all the bits found in other answers and comments. There currently seems only to be a single bit left (see below, missing bit).
First, we kill the status line of
tmux and the
tty. Afterwards we correct it again, using a method which should be always available (unlike
How to make a tmux terminal (assumes
stty -echo; printf '\016\033k%2000s\\\033\033]2;\355\007' $'\302\217'
Warning: After running above command, the shell looks blind and deaf and seems only to talk bullshit in some unknown alien language. See below on how to repair this.
stty -echo kills the terminal type response
printf '\016' does a
SO, so you are on the alternate character set
printf '\033]2;%s\007' 'right status text' sets the right status, in this case
$'\355', which exposes a presentation bug
printf '\033k%2000s\033\\' $'\302\217' sets the window title name
This might be the combination you can see on the terminal after some interactive command crashed and dropped back into the shell. (With
/bin/cat you cannot reach
stty -echo IMHO)
Now clean up this mess
stty sane; printf '\033k%s\033\\\033]2;%s\007' "$(basename "$SHELL")" "$(uname -n)"; tput reset; tmux refresh
Note: If you use copy and paste, you probably cannot see your paste if you have used the above command to mess up with your
tty. Hence, just blindly press the Enter key after pasting this.
stty sane sets "sane" terminal paramters, so you get your echo while typing back
printf '\033k%s\033\\' "$(basename "$SHELL")" sets the window title back to normal. You can use
tmux rename-window "$(basename "$SHELL")" alternatively, however
tmux rename-window is limited to
tmux where the escape sequence always works.
printf '\033]2;%s\007' "$(uname -n)" resets the status-right to be shown as default. (Note that you should not use
tmux set status-right "something", because it just outputs the
pane title which got corrupt, so
status-right just exposes some presentation bug. Also note that I did not find a
tmux command to set the pane title directly.)
tput reset resets the terminal, just in case this has been messed with
tmux refresh refreshs the screen to get rid of other debris which might have shown up
printf '\033k%s\033\\' "$(basename "$SHELL")" looses the standard ability of
tmux to present the current command in the left status area, which is sad.
I did not find a way to restore that capability, once
printf '\033k%s\033\\' "something" was executed. Perhaps someone else can solve this bit to complete the puzzle.