Bind ctrl-C to copy path to clipboard

Refs #173
This commit is contained in:
Kevin Sawicki
2013-01-25 17:51:34 -08:00
parent 985dd284dc
commit 1b76b05e4d
3 changed files with 11 additions and 0 deletions

View File

@@ -2212,3 +2212,8 @@ describe "Editor", ->
edited = editor.replaceSelectedText(replacer)
expect(replaced).toBe true
expect(edited).toBe false
describe "when editor:copy-path is triggered", ->
it "copies the absolute path to the editor's file to the pasteboard", ->
editor.trigger 'editor:copy-path'
expect(pasteboard.read()[0]).toBe editor.getPath()

View File

@@ -182,6 +182,7 @@ class Editor extends View
'editor:close-other-edit-sessions': @destroyInactiveEditSessions
'editor:close-all-edit-sessions': @destroyAllEditSessions
'editor:select-grammar': @selectGrammar
'editor:copy-path': @copyPathToPasteboard
documentation = {}
for name, method of editorBindings
@@ -1154,3 +1155,7 @@ class Editor extends View
@insertText(text, select: true)
true
copyPathToPasteboard: ->
path = @getPath()
pasteboard.write(path) if path?

View File

@@ -37,3 +37,4 @@
'alt-meta-w': 'editor:close-other-edit-sessions'
'meta-P': 'editor:close-all-edit-sessions'
'meta-L': 'editor:select-grammar'
'ctrl-C': 'editor:copy-path'