From b1e99d9927d94b884aa8a12ed0a9371eaa250e04 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 3 Feb 2014 13:10:10 -0800 Subject: [PATCH] Use atom.clipboard instead of atom.pasteboard --- spec/editor-spec.coffee | 6 +++--- spec/editor-view-spec.coffee | 2 +- spec/pasteboard-spec.coffee | 12 ++++++------ src/editor-view.coffee | 6 +++--- src/editor.coffee | 2 +- src/selection.coffee | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/spec/editor-spec.coffee b/spec/editor-spec.coffee index 7339c3dda..741ea3b4c 100644 --- a/spec/editor-spec.coffee +++ b/spec/editor-spec.coffee @@ -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) {" diff --git a/spec/editor-view-spec.coffee b/spec/editor-view-spec.coffee index 329e12e5b..54d435185 100644 --- a/spec/editor-view-spec.coffee +++ b/spec/editor-view-spec.coffee @@ -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", -> diff --git a/spec/pasteboard-spec.coffee b/spec/pasteboard-spec.coffee index f52779a37..5e8dddfde 100644 --- a/spec/pasteboard-spec.coffee +++ b/spec/pasteboard-spec.coffee @@ -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'} diff --git a/src/editor-view.coffee b/src/editor-view.coffee index c3754070b..e29a2cc13 100644 --- a/src/editor-view.coffee +++ b/src/editor-view.coffee @@ -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 ### diff --git a/src/editor.coffee b/src/editor.coffee index 0012f0f35..bc422b154 100644 --- a/src/editor.coffee +++ b/src/editor.coffee @@ -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 diff --git a/src/selection.coffee b/src/selection.coffee index e1a8d4b03..7847e33f9 100644 --- a/src/selection.coffee +++ b/src/selection.coffee @@ -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: ->