meta-x removes text from buffer and places it on the clipboard

This commit is contained in:
Corey Johnson
2012-02-02 09:35:18 -08:00
parent 3c37c0ebeb
commit d2a6eca8f3
4 changed files with 49 additions and 16 deletions

View File

@@ -44,6 +44,7 @@ class Editor extends Template
enter: 'newline'
backspace: 'delete-left'
delete: 'delete-right'
'meta-x': 'cut'
'meta-c': 'copy'
'meta-v': 'paste'
@@ -58,6 +59,7 @@ class Editor extends Template
@on 'newline', => @insertNewline()
@on 'delete-left', => @deleteLeft()
@on 'delete-right', => @deleteRight()
@on 'cut', => @cutSelection()
@on 'copy', => @copySelection()
@on 'paste', => @paste()
@@ -201,6 +203,7 @@ class Editor extends Template
insertText: (text) -> @selection.insertText(text)
insertNewline: -> @selection.insertNewline()
cutSelection: -> @selection.cut()
copySelection: -> @selection.copy()
paste: -> @selection.insertText(atom.native.readFromPasteboard())

View File

@@ -125,9 +125,11 @@ class Selection extends Template
moveCursorToLineStart: ->
@cursor.moveToLineStart()
cut: ->
@copy()
@delete()
copy: ->
return if @isEmpty()
text = @editor.buffer.getTextInRange @getRange()
atom.native.writeToPasteboard text