Guest User

Untitled

a guest
Feb 21st, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. # atom
  2. # stop ctrl-c on from wiping out what uyou have in the clipboard
  3.  
  4. # prevent core:copy if and only if there's one selection in
  5. # the active editor (mini or not) and its length equals 0
  6. atom.commands.add 'atom-text-editor', 'core:copy', (e) ->
  7. editor = e.currentTarget.getModel()
  8.  
  9. # do nothing if there's more than 1 selection
  10. return if editor.getSelectedBufferRanges().length > 1
  11.  
  12. # get the starting and ending points of the selection
  13. {start, end} = editor.getSelectedBufferRange()
  14.  
  15. # stop the command from immediate propagation (i.e.
  16. # executing the same command on the same element or
  17. # an element higher up the DOM tree). This works
  18. # because atom executes commands in the reverse order
  19. # they were registered with atom.commands.add, and this
  20. # one's added after the core commands are already
  21. # registered.
  22. if start.column is end.column and start.row is end.row
  23. e.stopImmediatePropagation()
Add Comment
Please, Sign In to add comment