I'm working over ssh on a linux machine (RHEL 6.8) from MacOS (Yosemite) through iTerm2 (3.0.20161031-nightly). On the remote server, I work in screens (Screen version 4.00.03).

Edit: everything below holds true for highlighting text and trying CMD+C, CMD+V for copy/paste

The remote server was rebooted for standard security update reasons the other day. Ever since, copy-paste in the remote screens is all messed up and I have no idea what's going wrong.

If I open up a fresh iTerm2 session on my laptop, I can highlight copy and middle-click paste text with my mouse as usual.

If I ssh into the remote machine and try to copy/paste something from the initial command line prompt, everything works.

If I reconnect to my screen and start a new sub-screen and try to copy/paste something, everything works.

If I log into a similar remote server with a similar setup, go into emacs -nw in a screen on that machine and try to copy/paste, everything works.

However, when I log into this server and connected to a screen running, say ipython or emacs (in terminal mode), which is how I always work, the mouse highlight / middle click paste scheme goes haywire. Until this week, it worked normally.

From within my reconnected screen (I use sub-screens that I flip back and forth between):

  • In emacs highlighting and middle-clicking does nothing (at the moment, though I think before it was behaving the same as below. Edit: it does. The behavior is the same in ipython and emacs, and are apparently tied together).

  • In e.g. ipython, if I highlight some text and then middle-click, what's pasted is actually the text from some number of lines (the exact number changes) below what's highlighted, e.g.:

    ?         -> Introduction and overview of IPython's features.
    %quickref -> Quick reference.
    help      -> Python's own help system.
    object?   -> Details about 'object', use 'object??' for extra details.

if I highlight "Introduction and overview" and middle-click on the python command line, what's pasted is "Details about 'object', u"

This all worked normally until this week; I might have tweaked some settings in e.g. emacs awhile back to make everything work with the mouse. As far as I know, nothing on my machine has changed. But my understanding of the copy-paste dynamic here is that it would be all my system and not the remote server. But I only see the problem within screens on this remote server.

Any ideas on what might be going wrong here?

  • I have a similar problem. I believe it is related to the fact that we are using screen. I removed the lines relating to mousetrack from my .screenrc and regained access to copy/pasting. I am not sure if mousetrack and mouse-based copy/paste can be made to work together. I am on Windows 8.1 with Cygwin logging into Centos machines. – HansHarhoff Feb 2 '17 at 10:43

Had a similar issue, for me it was mousetrack option that was confusing me in my ~/.screenrc.

You can turn mousetrack off with:
Ctrl+a+: and :mousetrack off

You can check mousetrack status from active screen with:
Ctrl+a+: and :mousetrack

Turning mousetrack off should convert the mouse behavior to the default for non mouse enabled programs (marking and pasting as expected).

| improve this answer | |
  • Worked for me via putty screen, im going to look to see if i have something overridden in my .screenrc, or add it if not. not sure why it started, maybe because its a different environment that i pulled my screenrc from. – Brian Thomas Aug 23 '17 at 23:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.