When copying, create selections marker layer on the *new* display layer

Previously, we were copying the selections marker layer into the current
editor’s display layer. This would work fine until the spatial mapping
drifted in the copied editor, and would then have counterintuitive
results.
This commit is contained in:
Nathan Sobo
2016-04-05 18:47:11 -06:00
parent b922262871
commit af28fa0752

View File

@@ -591,14 +591,15 @@ class TextEditor extends Model
# Create an {TextEditor} with its initial state based on this object
copy: ->
selectionsMarkerLayer = @getMarkerLayer(@buffer.getMarkerLayer(@selectionsMarkerLayer.id).copy().id)
displayLayer = @displayLayer.copy()
selectionsMarkerLayer = displayLayer.getMarkerLayer(@buffer.getMarkerLayer(@selectionsMarkerLayer.id).copy().id)
softTabs = @getSoftTabs()
newEditor = new TextEditor({
@buffer, selectionsMarkerLayer, @tabLength, softTabs,
suppressCursorCreation: true, @config, @notificationManager, @packageManager,
@firstVisibleScreenRow, @firstVisibleScreenColumn,
@clipboard, @viewRegistry, @grammarRegistry, @project, @assert, @applicationDelegate,
displayLayer: @buffer.copyDisplayLayer(@displayLayer.id)
displayLayer
})
newEditor