51

Possible Duplicate:
How can I prevent shift-delete from cutting in Windows?

I'm a programmer so I spend a lot of time in a text editor. For whatever reason about 25% of the time when I press the Delete key Windows will copy my selection to the clipboard right before deleting.

It's frustrating because I'll highlight some code that I want to move, press Ctrl+X and then highlight the extra space left behind and press Delete. A moment later I'll hit paste but instead of seeing what I copied I'll get a blank line (the content of what I deleted).

6
  • For those that saw my original post--I cleaned up the title and the description to remove irrelevant info.
    – Jeremy
    May 24, 2012 at 16:26
  • 2
    as a side note, installing ClipX means you don't have to worry about losing the data on your clipboard (downside: can't live without it now!)
    – Simon
    May 24, 2012 at 16:58
  • After Oliver pointed out the underlying cause of the problem I looked around for a permanent solution. I posted my findings as an "Answer" below.
    – Jeremy
    May 24, 2012 at 19:31
  • There's one work around if you use Visual Studio: use Ctrl+Shift+V to browse the clipboard history. May 24, 2012 at 21:28
  • If you're losing what was in your clipboard buffer, a handy little tool to download (assuming you're on windows) is a tool called ClipX (bluemars.org/clipx)
    – Roy Rico
    May 24, 2012 at 23:12

5 Answers 5

80

Solutions to this can either be found in this question:
How do I remap Shift + Del on Windows to mean Delete instead of Cut? or in Jeremy's own answer.

You're most likely pressing Shift+Del.

You still have Shift pressed from making your selection. Shift+Del is the key combination to Cut (just like Ctrl+X).

24
  • 8
    This can be extremely frustrating when cleaning up whitespace before pasting that special piece of code from your clipboard. Happens to me all the time, drives me crazy. May 24, 2012 at 13:19
  • 10
    Thank you so much--you just solved my problem! I'm a little embarrassed that I was unaware of this keyboard combination though. I've always known about shift + insert but somehow never heard of shift + del (makes sense though). Thanks again!
    – Jeremy
    May 24, 2012 at 13:20
  • 8
    Just some additional information, this is a key combination for left handed users, so they can use it while holding the mouse (like right handed users can with Ctrl+C etc.)
    – Holger
    May 24, 2012 at 14:52
  • 4
    @Jeremy: I've seen it in Visual Studio -- I just go to the Keyboard shortcuts page, find the Shift+Delete entry, and instead of mapping it to Cut, I map it to LineDelete (or whatever it was called). Then it actually does something useful. :)
    – user541686
    May 24, 2012 at 15:14
  • 2
    @Holger: Found something. They seem to come from IBM CUA. Not sure if their intention was to ease access for left-handed users. But it works nevertheless :) May 24, 2012 at 15:20
8

* SOLUTION *

After Oliver pointed out that shift+delete is a keyboard shortcut for Cut (just like Ctrl+x) I started looking for a way to turn this "feature" off.

The only solution I've found is to use AutoHotKey (free). Here's some basic setup instructions for anyone else that's interested:

First, install AutoHotKey, run it and allow it to create (and open) the example/default AutoHotkey.ahk script when it prompts you. Add the following to the script:

+Delete::
    KeyWait, Shift
    Send, {Delete}
    return

I'm not sure but you may have to "reload" the script before it starts working (I reloaded before testing). To reload, bring the AutoHotKey app to the foreground and press Ctrl+R (or click File -> Reload Script).

If you're happy with the results then you'll probably want to setup AutoHotKey to run automatically on startup. This is done by selecting the AutoHotkey.ahk file (in your 'My Documents' folder) and then going to your startup folder (C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup) and clicking "Paste Shortcut" from the "Edit" menu (Press Alt+E if you don't see an menu bar).

In testing, this fix worked great for me on Windows 7. Thanks to Oliver for identifying the underlying problem! :-)

5
  • 8
    You know, you could just learn to type properly as well ;P
    – Svish
    May 24, 2012 at 20:12
  • +1 Svish. And there is no reason to quote "feature". Using ctrl-c for copying in some programs (those using windows) and canceling tasks in others (those running in a console window) is a "feature". But using different key combinations for different tasks is a feature. May 25, 2012 at 7:22
  • Also, what do you do on machines that do not have AutoHotKey installed, be it in a library or in a web café?
    – krlmlr
    May 25, 2012 at 7:57
  • There actually was a question like that. user946850 found it. Cheers. May 25, 2012 at 9:54
  • Shift+Del has been cut to clipboard for so long you'd think everyone knew by now. Please RTFM Dec 19, 2023 at 15:11
2

Another possibility is a Sticky Key accessibility feature in Windows 7, so you pressed Shift key before and when you press Del, Sticky Key combines them to Shift+Del, which is another shortcut for Cut (to the buffer).

I found following article helpful in figuring out the setting - Stuck shift keys - windows 7 64 bit.

0

Is this happening on both of your Win7 boxes? If it's only one, I'd tend to think perhaps a problem with your keyboard as the C and X keys are side by side. Perhaps the C key partially sticking and getting depressed slightly when you press the X key. The only other time I've seen this happen is when my finger doesn't go to the key my brain tells it too. :) I have a half dozen Win7 machines and I've never seen this happen except when I could attribute it to either the keyboard or my fat finger.

1
  • That's what was strange to me--it was happening on two computers. I'd have tried swapping keyboards if it was just one computer. It turns out that Oliver was right. I may have to find a tool that allows me to disable the shift + del keyboard combination. Thanks for sharing your thoughts. :-)
    – Jeremy
    May 24, 2012 at 13:23
0

Since the underlying cause is due to the Shift+Del shortcut, another solution would be to use Backspace to delete highlighted text rather than Del.

Even though Del and Backspace normally perform different actions (at least on PCs), they can both be used to delete a selection. And there's no risk of overwriting your clipboard, since Shift+Backspace is the same as Backspace.

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