0

The messy codes looks like this:

enter image description here

As to reproduction, firstly I ssh a server and open the tmux. then if there is a disconnection, whatever the mouse action (like click or scroll) I made, it would show the messy code. My tmux.conf:

set-option -g prefix2 `

set-option -g mouse on 
bind C-c run " tmux save-buffer - | xclip -i -sel clipboard"
bind C-v run " tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer"
2
  • 1
    Are you talking about graceful disconnection? If ungraceful, then it's nothing unusual. What is your question exactly? Do you want explanation? Or just a command to fix the terminal? (tput reset). Or something else? Commented Mar 10, 2020 at 14:50
  • thanks for your message. it's ungraceful disconnection. my question is how can I avoid closing the session and open a new session? if I keep using the same session, it would show the messy code when I make mouse action.
    – DennisLi
    Commented Mar 10, 2020 at 15:02

1 Answer 1

0

Unfortunately, there is nothing you or tmux can do about this.

tmux mostly tries to make sure the terminal is in a sensible state when it is idle, for example it sets the default colours and attributes. This is so if the connection drops or if you do something like ~. in ssh, you are not left typing in red or with the cursor in a strange position.

But it can't do this for the mouse, because if tmux turned the mouse off, it wouldn't be told of any new mouse events. So if you disconnect without detaching or killing tmux, the terminal may be left with the mouse enabled, which means you will see this input when you use the mouse.

The only thing you can do is turn off the mouse in tmux, or run reset or tput reset after it happens.

You must log in to answer this question.

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