Use atom.clipboard instead of atom.pasteboard

This commit is contained in:
Kevin Sawicki
2014-02-03 13:10:10 -08:00
parent fc2be08b60
commit b1e99d9927
6 changed files with 16 additions and 16 deletions

View File

@@ -1885,7 +1885,7 @@ describe "Editor", ->
editor.cutToEndOfLine()
expect(buffer.lineForRow(2)).toBe ' if (items.length'
expect(buffer.lineForRow(3)).toBe ' var pivot = item'
expect(atom.pasteboard.read().text).toBe ' <= 1) return items;\ns.shift(), current, left = [], right = [];'
expect(atom.clipboard.read().text).toBe ' <= 1) return items;\ns.shift(), current, left = [], right = [];'
describe "when text is selected", ->
it "only cuts the selected text, not to the end of the line", ->
@@ -1895,7 +1895,7 @@ describe "Editor", ->
expect(buffer.lineForRow(2)).toBe ' if (items.lengthurn items;'
expect(buffer.lineForRow(3)).toBe ' var pivot = item'
expect(atom.pasteboard.read().text).toBe ' <= 1) ret\ns.shift(), current, left = [], right = [];'
expect(atom.clipboard.read().text).toBe ' <= 1) ret\ns.shift(), current, left = [], right = [];'
describe ".copySelectedText()", ->
it "copies selected text onto the clipboard", ->
@@ -1906,7 +1906,7 @@ describe "Editor", ->
describe ".pasteText()", ->
it "pastes text into the buffer", ->
atom.pasteboard.write('first')
atom.clipboard.write('first')
editor.pasteText()
expect(editor.buffer.lineForRow(0)).toBe "var first = function () {"
expect(buffer.lineForRow(1)).toBe " var first = function(items) {"

View File

@@ -2517,7 +2517,7 @@ describe "EditorView", ->
describe "when editor:copy-path is triggered", ->
it "copies the absolute path to the editor view's file to the pasteboard", ->
editorView.trigger 'editor:copy-path'
expect(atom.pasteboard.read().text).toBe editor.getPath()
expect(atom.clipboard.read().text).toBe editor.getPath()
describe "when editor:move-line-up is triggered", ->
describe "when there is no selection", ->

View File

@@ -1,11 +1,11 @@
describe "Pasteboard", ->
describe "write(text, metadata) and read()", ->
it "writes and reads text to/from the native pasteboard", ->
expect(atom.pasteboard.read().text).toBe 'initial pasteboard content'
atom.pasteboard.write('next')
expect(atom.pasteboard.read().text).toBe 'next'
expect(atom.clipboard.read().text).toBe 'initial pasteboard content'
atom.clipboard.write('next')
expect(atom.clipboard.read().text).toBe 'next'
it "returns metadata if the item on the native pasteboard matches the last written item", ->
atom.pasteboard.write('next', {meta: 'data'})
expect(atom.pasteboard.read().text).toBe 'next'
expect(atom.pasteboard.read().metadata).toEqual {meta: 'data'}
atom.clipboard.write('next', {meta: 'data'})
expect(atom.clipboard.read().text).toBe 'next'
expect(atom.clipboard.read().metadata).toEqual {meta: 'data'}

View File

@@ -209,7 +209,7 @@ class EditorView extends View
'editor:toggle-line-comments': => @toggleLineCommentsInSelection()
'editor:log-cursor-scope': => @logCursorScope()
'editor:checkout-head-revision': => @checkoutHead()
'editor:copy-path': => @copyPathToPasteboard()
'editor:copy-path': => @copyPathToClipboard()
'editor:move-line-up': => @editor.moveLineUp()
'editor:move-line-down': => @editor.moveLineDown()
'editor:duplicate-line': => @editor.duplicateLine()
@@ -1411,9 +1411,9 @@ class EditorView extends View
@highlightedLine = null
# Copies the current file path to the native clipboard.
copyPathToPasteboard: ->
copyPathToClipboard: ->
path = @editor.getPath()
atom.pasteboard.write(path) if path?
atom.clipboard.write(path) if path?
### Internal ###

View File

@@ -559,7 +559,7 @@ class Editor extends Model
# * options:
# + A set of options equivalent to {Selection.insertText}.
pasteText: (options={}) ->
{text, metadata} = atom.pasteboard.read()
{text, metadata} = atom.clipboard.read()
containsNewlines = text.indexOf('\n') isnt -1

View File

@@ -528,11 +528,11 @@ class Selection
return if @isEmpty()
text = @editor.buffer.getTextInRange(@getBufferRange())
if maintainPasteboard
text = atom.pasteboard.read().text + '\n' + text
text = atom.clipboard.read().text + '\n' + text
else
metadata = { indentBasis: @editor.indentationForBufferRow(@getBufferRange().start.row) }
atom.pasteboard.write(text, metadata)
atom.clipboard.write(text, metadata)
# Public: Creates a fold containing the current selection.
fold: ->