Why are random characters inserted into my tmux session?

22

9

Sometimes when I use the mouse, or press and hold a movement key in tmux, random characters are inserted. For example, when I press the left movement key, "D" is often inserted. A left mouse click often results in "[M#§T" - Does anyone know why this is?

I'm using tmux-1.6, and I get these errors over an SSH session & using mobaXterm on Windows 7.

Jonatan

Posted 2012-04-25T18:03:43.977

Reputation: 720

Answers

11

I found that the problem is with the terminal, and not tmux. Terminals need to support "utf8 mouse", and if they don't this is the symptoms experienced. Switching to putty or uxterm solved the issue for me.

Jonatan

Posted 2012-04-25T18:03:43.977

Reputation: 720

30

I have been running into this problem also (my terminal being terminator), and found the comment about the UTF8 mouse helped. I was actually able to continue using my current terminal program with tmux set mouse-utf8 off.

Which seems to have solved the problem. I've set this in my ~/.tmux.conf accordingly.

The entry in tmux.conf should look like this: set -g mouse-utf8 off, with the -g global switch (use the option for all sessions).

huin

Posted 2012-04-25T18:03:43.977

Reputation: 401

2The option does not exist anymore as of tmux v2.2 – saveman71 – 2016-05-11T09:38:27.183

To elaborate on the comment by @saveman71: UTF8 support is detected automatically from tmux 2.2 on, the problem described by OP should be fixed without having to set mouse-utf8 off. See https://raw.githubusercontent.com/tmux/tmux/master/CHANGES

– Tomas – 2016-05-30T12:41:24.983

2+1 Thanks this helped with guake/linux mint/byobu What am I loosing with this setting though? – Karthik T – 2013-09-21T09:50:57.303

5

I use Cygwin mintty and found I had to change the Options;

  • Options-->Mouse->Default
  • Click target from Application to Window.

After that I could click inside Tmux>Vim with no funny characters being inserted, and mouse wheel started working again.

Mark

Posted 2012-04-25T18:03:43.977

Reputation: 51

1I owe you beer. – airstrike – 2016-05-08T02:38:30.780

2

I had the same problem on Mac OS X and iTerm2. I filed it as a bug with the iTerm2 maintainers, but was never able to get a good log file to submit to them. In the end, I just disabled tmux's mouse support with mode-mouse off. Your question leads me to believe that this may be a tmux issue after all. I would file a bug report with tmux and see where that leads.

chepner

Posted 2012-04-25T18:03:43.977

Reputation: 5 645

I see.. Thanks for your comment. I have observed the same behavior on gnome-terminal on a RHEL5 machine recently as well. Do you know which version of tmux you used? Perhaps this is an issue with recent versions. The problem has become so obvious that it's actually hard to use tmux now! – Jonatan – 2012-05-03T17:33:27.750

I don't recall. No earlier than 1.3, could have been as recent as 1.6. – chepner – 2012-05-03T17:41:38.893

I just ran into the same issue in tmux 1.6 and iTerm2. Only one window was affected, had to close it out and create a new one to fix it. – claytron – 2012-05-18T05:06:58.113