Replace pasteboard references with clipboard

This commit is contained in:
Kevin Sawicki
2014-02-03 13:12:33 -08:00
parent b1e99d9927
commit 569ab416b8
5 changed files with 19 additions and 19 deletions

View File

@@ -1856,12 +1856,12 @@ describe "Editor", ->
expect(editor.getCursorBufferPosition()).toEqual [0, 2]
expect(editor.getCursorScreenPosition()).toEqual [0, editor.getTabLength() * 2]
describe "pasteboard operations", ->
describe "clipboard operations", ->
beforeEach ->
editor.setSelectedBufferRanges([[[0, 4], [0, 13]], [[1, 6], [1, 10]]])
describe ".cutSelectedText()", ->
it "removes the selected text from the buffer and places it on the pasteboard", ->
it "removes the selected text from the buffer and places it on the clipboard", ->
editor.cutSelectedText()
expect(buffer.lineForRow(0)).toBe "var = function () {"
expect(buffer.lineForRow(1)).toBe " var = function(items) {"

View File

@@ -2515,7 +2515,7 @@ describe "EditorView", ->
expect(edited).toBe false
describe "when editor:copy-path is triggered", ->
it "copies the absolute path to the editor view's file to the pasteboard", ->
it "copies the absolute path to the editor view's file to the clipboard", ->
editorView.trigger 'editor:copy-path'
expect(atom.clipboard.read().text).toBe editor.getPath()

View File

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

View File

@@ -95,9 +95,9 @@ beforeEach ->
TokenizedBuffer.prototype.chunkSize = Infinity
spyOn(TokenizedBuffer.prototype, "tokenizeInBackground").andCallFake -> @tokenizeNextChunk()
pasteboardContent = 'initial pasteboard content'
spyOn(clipboard, 'writeText').andCallFake (text) -> pasteboardContent = text
spyOn(clipboard, 'readText').andCallFake -> pasteboardContent
clipboardContent = 'initial clipboard content'
spyOn(clipboard, 'writeText').andCallFake (text) -> clipboardContent = text
spyOn(clipboard, 'readText').andCallFake -> clipboardContent
addCustomMatchers(this)

View File

@@ -535,24 +535,24 @@ class Editor extends Model
# Public: Copies and removes all characters from cursor to the end of the
# line.
cutToEndOfLine: ->
maintainPasteboard = false
maintainClipboard = false
@mutateSelectedText (selection) ->
selection.cutToEndOfLine(maintainPasteboard)
maintainPasteboard = true
selection.cutToEndOfLine(maintainClipboard)
maintainClipboard = true
# Public: Cuts the selected text.
cutSelectedText: ->
maintainPasteboard = false
maintainClipboard = false
@mutateSelectedText (selection) ->
selection.cut(maintainPasteboard)
maintainPasteboard = true
selection.cut(maintainClipboard)
maintainClipboard = true
# Public: Copies the selected text.
copySelectedText: ->
maintainPasteboard = false
maintainClipboard = false
for selection in @getSelections()
selection.copy(maintainPasteboard)
maintainPasteboard = true
selection.copy(maintainClipboard)
maintainClipboard = true
# Public: Pastes the text in the clipboard.
#