@@ -2388,6 +2388,31 @@ describe('TextEditorComponent', () => {
2388
2388
] )
2389
2389
} )
2390
2390
2391
+ it ( 'does not attempt to render block decorations located outside the visible range' , async ( ) => {
2392
+ const { editor, component} = buildComponent ( { autoHeight : false , rowsPerTile : 2 } )
2393
+ await setEditorHeightInLines ( component , 2 )
2394
+ expect ( component . getRenderedStartRow ( ) ) . toBe ( 0 )
2395
+ expect ( component . getRenderedEndRow ( ) ) . toBe ( 4 )
2396
+
2397
+ const marker1 = editor . markScreenRange ( [ [ 3 , 0 ] , [ 5 , 0 ] ] , { reversed : false } )
2398
+ const item1 = document . createElement ( 'div' )
2399
+ editor . decorateMarker ( marker1 , { type : 'block' , item : item1 } )
2400
+
2401
+ const marker2 = editor . markScreenRange ( [ [ 3 , 0 ] , [ 5 , 0 ] ] , { reversed : true } )
2402
+ const item2 = document . createElement ( 'div' )
2403
+ editor . decorateMarker ( marker2 , { type : 'block' , item : item2 } )
2404
+
2405
+ await component . getNextUpdatePromise ( )
2406
+ expect ( item1 . parentElement ) . toBeNull ( )
2407
+ expect ( item2 . nextSibling ) . toBe ( lineNodeForScreenRow ( component , 3 ) )
2408
+
2409
+ await setScrollTop ( component , 4 * component . getLineHeight ( ) )
2410
+ expect ( component . getRenderedStartRow ( ) ) . toBe ( 4 )
2411
+ expect ( component . getRenderedEndRow ( ) ) . toBe ( 8 )
2412
+ expect ( item1 . nextSibling ) . toBe ( lineNodeForScreenRow ( component , 5 ) )
2413
+ expect ( item2 . parentElement ) . toBeNull ( )
2414
+ } )
2415
+
2391
2416
it ( 'measures block decorations correctly when they are added before the component width has been updated' , async ( ) => {
2392
2417
{
2393
2418
const { editor, component, element} = buildComponent ( { autoHeight : false , width : 500 , attach : false } )
0 commit comments