mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Don't render decorations for invalidated markers
This commit is contained in:
committed by
Antonio Scandurra
parent
dfe647d914
commit
b242f034b4
@@ -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', () => {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user