mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Don't use atom.clipboard global in Selection
This commit is contained in:
committed by
Nathan Sobo
parent
b2d178f641
commit
b5fc710f15
@@ -14,7 +14,7 @@ class Selection extends Model
|
||||
initialScreenRange: null
|
||||
wordwise: false
|
||||
|
||||
constructor: ({@cursor, @marker, @editor, id}) ->
|
||||
constructor: ({@cursor, @marker, @editor, id, @clipboard}) ->
|
||||
@emitter = new Emitter
|
||||
|
||||
@assignId(id)
|
||||
@@ -611,7 +611,7 @@ class Selection extends Model
|
||||
startLevel = @editor.indentLevelForLine(precedingText)
|
||||
|
||||
if maintainClipboard
|
||||
{text: clipboardText, metadata} = atom.clipboard.readWithMetadata()
|
||||
{text: clipboardText, metadata} = @clipboard.readWithMetadata()
|
||||
metadata ?= {}
|
||||
unless metadata.selections?
|
||||
metadata.selections = [{
|
||||
@@ -624,9 +624,9 @@ class Selection extends Model
|
||||
indentBasis: startLevel,
|
||||
fullLine: fullLine
|
||||
})
|
||||
atom.clipboard.write([clipboardText, selectionText].join("\n"), metadata)
|
||||
@clipboard.write([clipboardText, selectionText].join("\n"), metadata)
|
||||
else
|
||||
atom.clipboard.write(selectionText, {
|
||||
@clipboard.write(selectionText, {
|
||||
indentBasis: startLevel,
|
||||
fullLine: fullLine
|
||||
})
|
||||
|
||||
@@ -2250,7 +2250,7 @@ class TextEditor extends Model
|
||||
unless marker.getProperties().preserveFolds
|
||||
@destroyFoldsContainingBufferRange(marker.getBufferRange())
|
||||
cursor = @addCursor(marker)
|
||||
selection = new Selection(_.extend({editor: this, marker, cursor}, options))
|
||||
selection = new Selection(_.extend({editor: this, marker, cursor, @clipboard}, options))
|
||||
@selections.push(selection)
|
||||
selectionBufferRange = selection.getBufferRange()
|
||||
@mergeIntersectingSelections(preserveFolds: marker.getProperties().preserveFolds)
|
||||
|
||||
Reference in New Issue
Block a user