Don't render decorations for invalidated markers

This commit is contained in:
Nathan Sobo
2017-04-19 16:46:17 -06:00
committed by Antonio Scandurra
parent dfe647d914
commit b242f034b4
2 changed files with 14 additions and 0 deletions

View File

@@ -934,6 +934,19 @@ describe('TextEditorComponent', () => {
expect(lineNodeForScreenRow(component, 2).classList.contains('b')).toBe(true)
expect(lineNodeForScreenRow(component, 3).classList.contains('b')).toBe(true)
})
it('does not decorate invalidated markers', async () => {
const {component, element, editor} = buildComponent()
const marker = editor.markScreenRange([[1, 0], [3, 0]], {invalidate: 'touch'})
editor.decorateMarker(marker, {type: ['line', 'line-number'], class: 'a'})
await component.getNextUpdatePromise()
expect(lineNodeForScreenRow(component, 2).classList.contains('a')).toBe(true)
editor.getBuffer().insert([2, 0], 'x')
expect(marker.isValid()).toBe(false)
await component.getNextUpdatePromise()
expect(lineNodeForScreenRow(component, 2).classList.contains('a')).toBe(false)
})
})
describe('highlight decorations', () => {

View File

@@ -94,6 +94,7 @@ class DecorationManager {
for (let i = 0; i < markers.length; i++) {
const marker = markers[i]
if (!marker.isValid()) continue
let decorationPropertiesForMarker = decorationPropertiesByMarker.get(marker)
if (decorationPropertiesForMarker == null) {