Search code examples
sublimetext3sublimetext

Sublime 3: Ctrl-c triggers even if no text is selected, drops text in clipboard


I'm using Sublime 3083.

Suppose I cut some text (Ctrl-x) in a file and then attempt to paste it somewhere else, in that same file or another one.

  1. I position the cursor on the line I want to paste the text.

  2. If I hit Ctrl-v the text is pasted with no issues.

  3. But if I accidentally hit Ctrl-c instead, the text that was cut can no longer be pasted. It is dropped from the clipboard and I'm forced to Ctrl-z back to the point before the text was cut.

This happens even if no text is selected when hitting Ctrl-c.

I tested and this behaviour seems to be exclusive from Sublime. Is this a feature? If so, can it be disabled?


Solution

  • There is a setting in Preferences > Settings - Default which can change the behavior:

    // If true, the copy and cut commands will operate on the current line
    // when the selection is empty, rather than doing nothing.
    
    "copy_with_empty_selection": false,
    

    Changing it to false should make it so that it doesn't copy an empty selection.