Avoid temporarily clearing DisplayLayer params in TextEditor.copy

This commit is contained in:
Max Brunsfeld
2016-12-14 17:05:59 -08:00
parent 39302aed35
commit 34c8e25eff

View File

@@ -114,9 +114,6 @@ class TextEditor extends Model
throw error
state.buffer = state.tokenizedBuffer.buffer
if state.displayLayer = state.buffer.getDisplayLayer(state.displayLayerId)
state.selectionsMarkerLayer = state.displayLayer.getMarkerLayer(state.selectionsMarkerLayerId)
state.assert = atomEnvironment.assert.bind(atomEnvironment)
editor = new this(state)
if state.registered
@@ -167,22 +164,24 @@ class TextEditor extends Model
grammar, tabLength, @buffer, @largeFileMode, @assert
})
displayLayerParams = {
invisibles: @getInvisibles(),
softWrapColumn: @getSoftWrapColumn(),
showIndentGuides: not @isMini() and @doesShowIndentGuide(),
atomicSoftTabs: params.atomicSoftTabs ? true,
tabLength: tabLength,
ratioForCharacter: @ratioForCharacter.bind(this),
isWrapBoundary: isWrapBoundary,
foldCharacter: ZERO_WIDTH_NBSP,
softWrapHangingIndent: params.softWrapHangingIndentLength ? 0
}
unless @displayLayer?
displayLayerParams = {
invisibles: @getInvisibles(),
softWrapColumn: @getSoftWrapColumn(),
showIndentGuides: not @isMini() and @doesShowIndentGuide(),
atomicSoftTabs: params.atomicSoftTabs ? true,
tabLength: tabLength,
ratioForCharacter: @ratioForCharacter.bind(this),
isWrapBoundary: isWrapBoundary,
foldCharacter: ZERO_WIDTH_NBSP,
softWrapHangingIndent: params.softWrapHangingIndentLength ? 0
}
if @displayLayer?
@displayLayer.reset(displayLayerParams)
else
@displayLayer = @buffer.addDisplayLayer(displayLayerParams)
if @displayLayer = @buffer.getDisplayLayer(params.displayLayerId)
@displayLayer.reset(displayLayerParams)
@selectionsMarkerLayer = @displayLayer.getMarkerLayer(params.selectionsMarkerLayerId)
else
@displayLayer = @buffer.addDisplayLayer(displayLayerParams)
@backgroundWorkHandle = requestIdleCallback(@doBackgroundWork)
@disposables.add new Disposable =>