From 68659d9698af283bfd4c3c91b264078bf79668eb Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 14 Mar 2017 15:48:04 -0600 Subject: [PATCH] When decorating a MarkerLayer, get its corresponding DisplayMarkerLayer This fixes 'folded' line number decorations. --- spec/text-editor-component-spec.js | 7 +++++++ src/decoration-manager.js | 1 + 2 files changed, 8 insertions(+) diff --git a/spec/text-editor-component-spec.js b/spec/text-editor-component-spec.js index cfd0e1afd..91a9e0bdf 100644 --- a/spec/text-editor-component-spec.js +++ b/spec/text-editor-component-spec.js @@ -224,6 +224,13 @@ describe('TextEditorComponent', () => { expect(scroller.clientWidth).toBe(scroller.scrollWidth) }) + it('decorates the line numbers of folded lines', async () => { + const {component, element, editor} = buildComponent() + editor.foldBufferRow(1) + await component.getNextUpdatePromise() + expect(lineNumberNodeForScreenRow(component, 1).classList.contains('folded')).toBe(true) + }) + describe('focus', () => { it('focuses the hidden input element and adds the is-focused class when focused', async () => { assertDocumentFocused() diff --git a/src/decoration-manager.js b/src/decoration-manager.js index 7a99d5809..84278eb8f 100644 --- a/src/decoration-manager.js +++ b/src/decoration-manager.js @@ -200,6 +200,7 @@ class DecorationManager { if (markerLayer.isDestroyed()) { throw new Error('Cannot decorate a destroyed marker layer') } + markerLayer = this.displayLayer.getMarkerLayer(markerLayer.id) const decoration = new LayerDecoration(markerLayer, this, decorationParams) let layerDecorations = this.layerDecorationsByMarkerLayer.get(markerLayer) if (layerDecorations == null) {