1

I use tmux on my remote terminal. I found that when the remote terminal was disconnected abnormally (e.g., I just closed my laptop without exiting remote terminal normally), my terminal on iTerm will start to output random characters if I scroll my mouse, or click.

Any advice how to fix it?

1
  • Well, the only way works for me is, ssh to remote server and re-attach to tmux.
    – oujiafan
    Commented May 20, 2019 at 17:56

2 Answers 2

6

I had the same issue and found this answer which helped me: Disable mouse reporting in a terminal session after tmux exits unexpectedly

To disable Mouse Reporting from bash, use this code:

printf '\e[?1000l'
2
  • OK. This can prevent random characters output. However, mouse scroll doesn't scroll the screen anymore.
    – oujiafan
    Commented May 20, 2019 at 20:06
  • @oujiafan, that's not the case for me. After printf '\e[?1000l' I can scroll just fine.
    – Cory
    Commented Jun 11, 2019 at 22:26
0

@cory's solution to reset the mouse reporting is effective. To automate this process, I'm using the following bash function:

function ssht() {
    ssh -t "$@" 'tmux'
    printf '\e[?1000l'  # to avoid mouse reporting issues
}

You must log in to answer this question.

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