@@ -85,7 +85,9 @@ export class ViewZoneManager extends Disposable {
85
85
const diff = diffModel ?. diff . read ( reader ) ;
86
86
if ( ! diffModel || ! diff ) { return null ; }
87
87
state . read ( reader ) ;
88
- return computeRangeAlignment ( this . _editors . original , this . _editors . modified , diff . mappings , alignmentViewZoneIdsOrig , alignmentViewZoneIdsMod ) ;
88
+ const renderSideBySide = this . _options . renderSideBySide . read ( reader ) ;
89
+ const innerHunkAlignment = renderSideBySide ;
90
+ return computeRangeAlignment ( this . _editors . original , this . _editors . modified , diff . mappings , alignmentViewZoneIdsOrig , alignmentViewZoneIdsMod , innerHunkAlignment ) ;
89
91
} ) ;
90
92
91
93
const alignmentsSyncedMovedText = derived < ILineRangeAlignment [ ] | null > ( 'alignments' , ( reader ) => {
@@ -94,7 +96,7 @@ export class ViewZoneManager extends Disposable {
94
96
state . read ( reader ) ;
95
97
const mappings = syncedMovedText . changes . map ( c => new DiffMapping ( c ) ) ;
96
98
// TODO dont include alignments outside syncedMovedText
97
- return computeRangeAlignment ( this . _editors . original , this . _editors . modified , mappings , alignmentViewZoneIdsOrig , alignmentViewZoneIdsMod ) ;
99
+ return computeRangeAlignment ( this . _editors . original , this . _editors . modified , mappings , alignmentViewZoneIdsOrig , alignmentViewZoneIdsMod , true ) ;
98
100
} ) ;
99
101
100
102
function createFakeLinesDiv ( ) : HTMLElement {
@@ -455,6 +457,7 @@ function computeRangeAlignment(
455
457
diffs : readonly DiffMapping [ ] ,
456
458
originalEditorAlignmentViewZones : ReadonlySet < string > ,
457
459
modifiedEditorAlignmentViewZones : ReadonlySet < string > ,
460
+ innerHunkAlignment : boolean ,
458
461
) : ILineRangeAlignment [ ] {
459
462
const originalLineHeightOverrides = new ArrayQueue ( getAdditionalLineHeights ( originalEditor , originalEditorAlignmentViewZones ) ) ;
460
463
const modifiedLineHeightOverrides = new ArrayQueue ( getAdditionalLineHeights ( modifiedEditor , modifiedEditorAlignmentViewZones ) ) ;
@@ -546,18 +549,21 @@ function computeRangeAlignment(
546
549
modifiedRange,
547
550
originalHeightInPx : originalRange . length * origLineHeight + originalAdditionalHeight ,
548
551
modifiedHeightInPx : modifiedRange . length * modLineHeight + modifiedAdditionalHeight ,
552
+ diff : m . lineRangeMapping ,
549
553
} ) ;
550
554
551
555
lastOrigLineNumber = origLineNumberExclusive ;
552
556
lastModLineNumber = modLineNumberExclusive ;
553
557
}
554
558
555
- for ( const i of c . innerChanges || [ ] ) {
556
- if ( i . originalRange . startColumn > 1 && i . modifiedRange . startColumn > 1 ) {
557
- // There is some unmodified text on this line
558
- emitAlignment ( i . originalRange . startLineNumber , i . modifiedRange . startLineNumber ) ;
559
+ if ( innerHunkAlignment ) {
560
+ for ( const i of c . innerChanges || [ ] ) {
561
+ if ( i . originalRange . startColumn > 1 && i . modifiedRange . startColumn > 1 ) {
562
+ // There is some unmodified text on this line
563
+ emitAlignment ( i . originalRange . startLineNumber , i . modifiedRange . startLineNumber ) ;
564
+ }
565
+ emitAlignment ( i . originalRange . endLineNumber , i . modifiedRange . endLineNumber ) ;
559
566
}
560
- emitAlignment ( i . originalRange . endLineNumber , i . modifiedRange . endLineNumber ) ;
561
567
}
562
568
563
569
emitAlignment ( c . originalRange . endLineNumberExclusive , c . modifiedRange . endLineNumberExclusive ) ;
0 commit comments