@@ -13,7 +13,7 @@ import { ViewContext } from 'vs/editor/common/view/viewContext';
1313import * as viewEvents from 'vs/editor/common/view/viewEvents' ;
1414import { IViewWhitespaceViewportData } from 'vs/editor/common/viewModel/viewModel' ;
1515import { EditorOption } from 'vs/editor/common/config/editorOptions' ;
16- import { IWhitespaceChangeAccessor } from 'vs/editor/common/viewLayout/linesLayout' ;
16+ import { IWhitespaceChangeAccessor , EditorWhitespace } from 'vs/editor/common/viewLayout/linesLayout' ;
1717
1818export interface IMyViewZone {
1919 whitespaceId : string ;
@@ -74,6 +74,11 @@ export class ViewZones extends ViewPart {
7474 // ---- begin view event handlers
7575
7676 private _recomputeWhitespacesProps ( ) : boolean {
77+ const whitespaces = this . _context . viewLayout . getWhitespaces ( ) ;
78+ const oldWhitespaces = new Map < string , EditorWhitespace > ( ) ;
79+ for ( const whitespace of whitespaces ) {
80+ oldWhitespaces . set ( whitespace . id , whitespace ) ;
81+ }
7782 return this . _context . viewLayout . changeWhitespace ( ( whitespaceAccessor : IWhitespaceChangeAccessor ) => {
7883 let hadAChange = false ;
7984
@@ -82,7 +87,9 @@ export class ViewZones extends ViewPart {
8287 const id = keys [ i ] ;
8388 const zone = this . _zones [ id ] ;
8489 const props = this . _computeWhitespaceProps ( zone . delegate ) ;
85- if ( whitespaceAccessor . changeOneWhitespace ( id , props . afterViewLineNumber , props . heightInPx ) ) {
90+ const oldWhitespace = oldWhitespaces . get ( id ) ;
91+ if ( oldWhitespace && ( oldWhitespace . afterLineNumber !== props . afterViewLineNumber || oldWhitespace . heightInPx !== props . heightInPx ) ) {
92+ whitespaceAccessor . changeOneWhitespace ( id , props . afterViewLineNumber , props . heightInPx ) ;
8693 this . _safeCallOnComputedHeight ( zone . delegate , props . heightInPx ) ;
8794 hadAChange = true ;
8895 }
@@ -286,20 +293,19 @@ export class ViewZones extends ViewPart {
286293 }
287294
288295 private _layoutZone ( whitespaceAccessor : IWhitespaceChangeAccessor , id : string ) : boolean {
289- let changed = false ;
290296 if ( this . _zones . hasOwnProperty ( id ) ) {
291297 const zone = this . _zones [ id ] ;
292298 const props = this . _computeWhitespaceProps ( zone . delegate ) ;
293299 // const newOrdinal = this._getZoneOrdinal(zone.delegate);
294- changed = whitespaceAccessor . changeOneWhitespace ( zone . whitespaceId , props . afterViewLineNumber , props . heightInPx ) || changed ;
300+ whitespaceAccessor . changeOneWhitespace ( zone . whitespaceId , props . afterViewLineNumber , props . heightInPx ) ;
295301 // TODO@Alex : change `newOrdinal` too
296302
297- if ( changed ) {
298- this . _safeCallOnComputedHeight ( zone . delegate , props . heightInPx ) ;
299- this . setShouldRender ( ) ;
300- }
303+ this . _safeCallOnComputedHeight ( zone . delegate , props . heightInPx ) ;
304+ this . setShouldRender ( ) ;
305+
306+ return true ;
301307 }
302- return changed ;
308+ return false ;
303309 }
304310
305311 public shouldSuppressMouseDownOnViewZone ( id : string ) : boolean {
0 commit comments