@@ -165,16 +165,7 @@ export class MergeEditor extends AbstractTextEditor<IMergeEditorViewState> {
165
165
this . _store . add (
166
166
this . inputResultView . editor . onDidScrollChange (
167
167
reentrancyBarrier . makeExclusive ( ( c ) => {
168
- if ( c . scrollTopChanged ) {
169
- const mapping1 = this . model ?. input1ResultMapping . get ( ) ;
170
- synchronizeScrolling ( this . inputResultView . editor , this . input1View . editor , mapping1 , MappingDirection . output ) ;
171
- const mapping2 = this . model ?. input2ResultMapping . get ( ) ;
172
- synchronizeScrolling ( this . inputResultView . editor , this . input2View . editor , mapping2 , MappingDirection . output ) ;
173
- }
174
- if ( c . scrollLeftChanged ) {
175
- this . input1View . editor . setScrollLeft ( c . scrollLeft , ScrollType . Immediate ) ;
176
- this . input2View . editor . setScrollLeft ( c . scrollLeft , ScrollType . Immediate ) ;
177
- }
168
+ this . updateResultScrolling ( c . scrollTopChanged , c . scrollLeftChanged ) ;
178
169
} )
179
170
)
180
171
) ;
@@ -201,6 +192,19 @@ export class MergeEditor extends AbstractTextEditor<IMergeEditorViewState> {
201
192
toolbarMenuRender ( ) ;
202
193
}
203
194
195
+ private updateResultScrolling ( scrollTopChanged : boolean , scrollLeftChanged : boolean ) : void {
196
+ if ( scrollTopChanged ) {
197
+ const mapping1 = this . model ?. input1ResultMapping . get ( ) ;
198
+ synchronizeScrolling ( this . inputResultView . editor , this . input1View . editor , mapping1 , MappingDirection . output ) ;
199
+ const mapping2 = this . model ?. input2ResultMapping . get ( ) ;
200
+ synchronizeScrolling ( this . inputResultView . editor , this . input2View . editor , mapping2 , MappingDirection . output ) ;
201
+ }
202
+ if ( scrollLeftChanged ) {
203
+ this . input1View . editor . setScrollLeft ( this . inputResultView . editor . getScrollLeft ( ) , ScrollType . Immediate ) ;
204
+ this . input2View . editor . setScrollLeft ( this . inputResultView . editor . getScrollLeft ( ) , ScrollType . Immediate ) ;
205
+ }
206
+ }
207
+
204
208
public get viewModel ( ) : IObservable < MergeEditorViewModel | undefined > {
205
209
return this . input1View . viewModel ;
206
210
}
@@ -391,6 +395,7 @@ export class MergeEditor extends AbstractTextEditor<IMergeEditorViewState> {
391
395
} ) ) ;
392
396
mirrorWordWrapTransientState ( ) ;
393
397
398
+ this . updateResultScrolling ( true , true ) ;
394
399
395
400
// detect when base, input1, and input2 become empty and replace THIS editor with its result editor
396
401
// TODO@jrieken @hediet this needs a better/cleaner solution
0 commit comments