Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

'copy' keyboard shortcut should not copy empty space #7103

Closed

Description

@davidawad

It's too frequent that someone might accidentally hit the 'c' key instead of the 'v' key when pasting in atom.

instead of copying empty space, the copy shortcut should simply not do anything.

I can write the pull request myself if someone can point me in the right direction, either way if we could improve this very annoying problem it would be great!

Activity

  1. benogle commented on Jun 4, 2015

    @benogle
    Contributor

    This was a deliberate decision. cc @maxbrunsfeld. I admit, I dislike it as well, but many people wanted this behavior.

  2. mnquintana commented on Jun 4, 2015

    @mnquintana
    Contributor

    @benogle This seems like an ideal candidate for a config option though

  3. davidawad commented on Jun 4, 2015

    @davidawad
    Author

    A config option would be perfect!

  4. maxbrunsfeld commented on Jun 4, 2015

    @maxbrunsfeld
    Contributor

    Just to clarify, in general it copies the line under the cursor, not empty space. I'd be ok w/ a config option.

  5. davidawad commented on Jun 9, 2015

    @davidawad
    Author

    So how would I implement this? I have no problem submitting a PR for it, it seems like a simple request.

  6. vemv-kantox commented on Jun 10, 2015

    @vemv-kantox

    I second this issue. People actually leveraging the current behavior may like a similiar but different key-binding: command-shift-c (free by default) could copy the current line regardless of selection.

  7. maxbrunsfeld commented on Jun 10, 2015

    @maxbrunsfeld
    Contributor

    People actually leveraging the current behavior may like a similar but different key-binding.

    This is good idea. @davidawad I think that the best way to do this would be to add a new command, editor:copy-selection that would write to the clipboard only if text were selected. That way, users who prefer that behavior could simply add this to their keymap:

    'atom-text-editor':
      `command-c`: `editor:copy-selection` # mac os
      `ctrl-c`: `editor:copy-selection`    # linux and windows
  8. lpommers commented on Jul 20, 2015

    @lpommers

    I've been playing with this locally and just looking for some input. For me I think it would be nice if copy didn't work unless something was selected or the cursor is at the beginning of the line. In that case I think I would find it useful if copy copied the line. Any thoughts?

  9. jschroeder9000 commented on Jul 22, 2015

    @jschroeder9000

    For me, I would prefer copy to do nothing if nothing is selected, even if the cursor is at the beginning of the line. If I accidentally hit ^c instead of ^v, I don't want it to blow away my clipboard contents, even if the cursor is at the beginning of the line. Nothing selected => nothing to do.

  10. MichaelJCole commented on Jan 9, 2016

    @MichaelJCole

    Thanks so much! This drove me mad. Here's how to implement it:

    Update Atom (doesn't work on 1.0.3. Works on 1.3.3)
    Edit -> Preferences -> Keybindings -> Click link at very top "your keymap file"
    This should open a file in the editor.

    Paste this:

    'atom-text-editor':
      'ctrl-c': 'editor:copy-selection'    # linux and windows
    

    Close and open Atom.

  11. MichaelJCole commented on Apr 20, 2016

    @MichaelJCole

    Unfortunately, this seems to have stopped working. The command pastes at the beginning of the line, instead of the cursor.

    UPDATE: It's working again in 1.18.0

  12. sinisarudan commented on Nov 20, 2017

    @sinisarudan

    Still not solved?? :( Not by a simple config option as suggested here ...?
    This

    'atom-text-editor':
      'ctrl-c': 'editor:copy-selection'    # linux and windows
    
    

    solution doesn't seem to work any more (ver 1.22.1), as worked before

  13. sinisarudan commented on Nov 20, 2017

    @sinisarudan

    the suggested solution doesn't work in newer versions (e.g. ver 1.22.1), as worked before, because of different coding of the keymap.cson file:
    but these steps work:

    Atom -> Preferences -> Keybindings -> Click link at very top "your keymap file"
    This should open a keymap.cson file in the editor.

    Paste this:

    'body':
      'cmd-c': 'editor:copy-selection' # mac os
      'ctrl-c': 'editor:copy-selection'    # linux and windows
    
    

    (I tested it on Mac, if it doesn't work on Win, you might need to adjust 'ctrl-c' code)

    P.S. if the internal coding of the keymap.cson file changes over time, you can go to
    Atom -> Preferences -> Keybindings
    and then you find there an entry with 'Keystroke' equal to 'cmd-c' and Selector equal to 'body'.
    You should copy the code of this settting by clicking on the icon on the left of that entry-row, and use it as a model for your entry in keymap.cson

    Here is screenshot (for Mac) of the above-writen:
    screen shot 2017-11-20 at 11 36 25

  14. vlad0337187 commented on Feb 9, 2018

    @vlad0337187

    I think, that there's no any use case for copying empty lines.
    If somebody needs empty line - he could just press enter. It's much simpler than copying empty line than pasting it.

    Also empty line is often copied by mistake, when wanted to press "ctrl + v".
    So such behaviour is not just neuter, but harmful.
    You forced to press "ctrl+z" and return to other place in file, or switch to other file and do such operation there.

    And modifying this in settings... Strange decision. Probably it would be better to leave old behaviour by default and such strange option may be turned on only by need.

    P.S. And yes, any of solutions doesn't work on Atom 1.23.3 under Linux Mint 18.3.

  15. MichaelJCole commented on Feb 9, 2018

    @MichaelJCole

    Hey @vlad1777d this issue is closed, so won't get any traction. You might have more luck if you open a new issue and reference this one...

  16. lock commented on Aug 8, 2018

    @lock

    This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks!

  17. locked as resolved and limited conversation to collaborators on Aug 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions