From af28fa075238cc58d721df5a5004ea807698eede Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 5 Apr 2016 18:47:11 -0600 Subject: [PATCH] When copying, create selections marker layer on the *new* display layer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/text-editor.coffee | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/text-editor.coffee b/src/text-editor.coffee index a7638afe9..7d4ad14ef 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -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