Ctrl+C to copy does not always work in Eclipse

Alright, here’s an annoying one.  When using Eclipse, I find that Ctrl+C fails to perform the “copy” operation.  Sometimes.

So, I press Ctrl+C to copy and go someplace else to paste and find the previous contents of the clipboard have been inserted.  Somewhat annoying.  I got into the habit of pressing Ctrl+C several times to make sure the copy command went through, but sometimes it still would not.

This issue does not appear to be specific to any particular platform or version.  I am experiencing the issue with Eclipse 4.1.2 on Windows, and a coworker of mine is experiencing the same thing in Eclipse 3.7.2 for OS X.  However, we are working on a rather large project (a few thousand files), which means Eclipse’s memory use is rather high and the editor seems to briefly “stall” from time to time.  These stalls aren’t long or annoying enough to get in the way of getting work done, but if you happen to hit the Ctrl+C while it is stalling, the copy command does not process.  The problem may get slightly worse if Eclipse is open for a long time.

That’s my working theory, anyway; I may be completely off, as others are reporting this and making no mention of a large project.  There is in fact a bug report on the issue in the Eclipse bug tracker that suggests that the bug may have been introduced in Indigo SR1 (Eclipse 3.7.1 and 4.1.1) — and also an older report describing similar behavior as far back as 2007, that was supposedly fixed, but people continued to report the issue was occurring.

In the newer report, Jun Luo suggested on Monday to unbind the keyboard shortcuts for cut, copy, and paste in Eclipse Preferences -> General -> Keys.  I tried removing the Ctrl+C binding and all week I have not experienced this issue, so I am calling it fixed.  My Mac-using coworker has not reported the issue recurring since removing the ⌘+C binding, either.

It is strange that removing the registered Ctrl+C shortcut for copying text actually fixes it.  I am supposing that this removes any special binding that Eclipse itself makes to Ctrl+C; however, the underlying SWT element still processes it as a copy command, and this works even if Eclipse is a little busy.

What’s funny is later on in the week, I experienced the same issue with Ctrl+X for “cut.”  I cut some text, it disappeared, and when I went to paste it, I got the previous contents of my clipboard.  So, I’ve disabled the “Ctrl+X” binding for “cut” as well.

4 thoughts on “Ctrl+C to copy does not always work in Eclipse”

  1. Not only did this show me how to fix the copy/paste issue I was having, It taught me that you can assign custom key bindings within Eclipse itself. Very handy, Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>