aaron-kelley.net

My little corner of the Internet

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.

Tags:

One Response to “Ctrl+C to copy does not always work in Eclipse”

  1. [...] which always seems to work. This is a pain, however. Fortunately I came across this blog post: Ctrl+C to copy does not always work in Eclipse which describes a simple fix: Unbind the copy command in Eclipse. Note that this also applies to [...]

Leave a Reply

This site is protected by Akismet. I now receive too many spam comments to manually check them all for misclassifications. If you suspect that your comment has been filtered as spam (i.e., it does not appear right away), please try rewording it and submitting again. Using no more than one hyperlink will also improve the chances of your comment not being accidentally filtered as spam.
327,816 spam comments detected since August 1, 2009.