@@ -126,6 +126,8 @@ export class DiffFile {
126126
127127 #composeByDiff: boolean = false ;
128128
129+ #composeByRange: boolean = false ;
130+
129131 #composeByMerge: boolean = false ;
130132
131133 #composeByFullMerge: boolean = false ;
@@ -1169,10 +1171,11 @@ export class DiffFile {
11691171 } ;
11701172
11711173 onSplitHunkExpand = ( dir : "up" | "down" | "all" | "up-all" | "down-all" , index : number , needTrigger = true ) => {
1174+ if ( this . getExpandEnabled ( ) ) return ;
1175+
11721176 const current = this . #splitHunksLines?. [ index ] ;
1173- if ( ! current || ! current . splitInfo ) return ;
11741177
1175- if ( this . #composeByDiff ) return ;
1178+ if ( ! current || ! current . splitInfo ) return ;
11761179
11771180 if ( dir === "all" ) {
11781181 for ( let i = current . splitInfo . startHiddenIndex ; i < current . splitInfo . endHiddenIndex ; i ++ ) {
@@ -1303,7 +1306,7 @@ export class DiffFile {
13031306
13041307 // TODO! support rollback?
13051308 onUnifiedHunkExpand = ( dir : "up" | "down" | "all" | "up-all" | "down-all" , index : number , needTrigger = true ) => {
1306- if ( this . #composeByDiff ) return ;
1309+ if ( this . getExpandEnabled ( ) ) return ;
13071310
13081311 const current = this . #unifiedHunksLines?. [ index ] ;
13091312
@@ -1405,7 +1408,7 @@ export class DiffFile {
14051408 } ;
14061409
14071410 onAllExpand = ( mode : "split" | "unified" ) => {
1408- if ( this . #composeByDiff ) return ;
1411+ if ( this . getExpandEnabled ( ) ) return ;
14091412
14101413 if ( mode === "split" ) {
14111414 Object . keys ( this . #splitHunksLines || { } ) . forEach ( ( key ) => {
@@ -1431,7 +1434,7 @@ export class DiffFile {
14311434 }
14321435
14331436 onAllCollapse = ( mode : "split" | "unified" ) => {
1434- if ( this . #composeByDiff ) return ;
1437+ if ( this . getExpandEnabled ( ) ) return ;
14351438
14361439 if ( mode === "split" ) {
14371440 Object . values ( this . #splitLeftLines || { } ) . forEach ( ( item ) => {
@@ -1552,7 +1555,7 @@ export class DiffFile {
15521555
15531556 getUpdateCount = ( ) => this . #updateCount;
15541557
1555- getExpandEnabled = ( ) => ! this . #composeByDiff;
1558+ getExpandEnabled = ( ) => ! this . #composeByDiff && ! this . #composeByRange ;
15561559
15571560 getBundle = ( ) => {
15581561 // common
@@ -1576,6 +1579,7 @@ export class DiffFile {
15761579 const additionLength = this . additionLength ;
15771580 const deletionLength = this . deletionLength ;
15781581 const composeByDiff = this . #composeByDiff;
1582+ const composeByRange = this . #composeByRange;
15791583 const highlighterName = this . #highlighterName;
15801584 const highlighterType = this . #highlighterType;
15811585 const hasSomeLineCollapsed = this . hasSomeLineCollapsed ;
@@ -1623,6 +1627,7 @@ export class DiffFile {
16231627 highlighterName,
16241628 highlighterType,
16251629 composeByDiff,
1630+ composeByRange,
16261631 hasSomeLineCollapsed,
16271632 hasExpandSplitAll,
16281633 hasExpandUnifiedAll,
@@ -1641,6 +1646,7 @@ export class DiffFile {
16411646 this . #hasBuildSplit = data . hasBuildSplit ;
16421647 this . #hasBuildUnified = data . hasBuildUnified ;
16431648 this . #composeByDiff = data . composeByDiff ;
1649+ this . #composeByRange = data . composeByRange ;
16441650 this . #highlighterName = data . highlighterName ;
16451651 this . #highlighterType = data . highlighterType ;
16461652
@@ -1741,8 +1747,8 @@ export class DiffFile {
17411747 const contextDiffFile = DiffFile . createInstance (
17421748 { } ,
17431749 {
1744- ...this . getBundle ( ) ,
1745- composeByDiff : true ,
1750+ ...this . _getFullBundle ( ) ,
1751+ composeByRange : true ,
17461752 splitHunkLines : { } ,
17471753 splitLeftLines : l ,
17481754 splitRightLines : r ,
0 commit comments