@@ -12,12 +12,14 @@ const InternalDiffUnifiedExtendLine = ({
1212 index,
1313 diffFile,
1414 lineNumber,
15+ enableWrap,
1516 oldLineExtend,
1617 newLineExtend,
1718} : {
1819 index : number ;
1920 diffFile : DiffFile ;
2021 lineNumber : number ;
22+ enableWrap : boolean ;
2123 oldLineExtend : { data : any } ;
2224 newLineExtend : { data : any } ;
2325} ) => {
@@ -27,9 +29,10 @@ const InternalDiffUnifiedExtendLine = ({
2729
2830 const unifiedItem = diffFile . getUnifiedLine ( index ) ;
2931
32+ // TODO use css variable to get width
3033 const width = useDomWidth ( {
3134 selector : ".unified-diff-table-wrapper" ,
32- enable : typeof renderExtendLine === "function" ,
35+ enable : typeof renderExtendLine === "function" && ! enableWrap ,
3336 } ) ;
3437
3538 if ( ! renderExtendLine ) return null ;
@@ -38,7 +41,7 @@ const InternalDiffUnifiedExtendLine = ({
3841 < tr data-line = { `${ lineNumber } -extend` } data-state = "extend" className = "diff-line diff-line-extend" >
3942 < td className = "diff-line-extend-content p-0 align-top" colSpan = { 2 } >
4043 < div className = "diff-line-extend-wrapper sticky left-0 z-[1]" style = { { width } } >
41- { width > 0 &&
44+ { ( enableWrap ? true : width > 0 ) &&
4245 oldLineExtend ?. data !== undefined &&
4346 oldLineExtend ?. data !== null &&
4447 renderExtendLine ?.( {
@@ -48,7 +51,7 @@ const InternalDiffUnifiedExtendLine = ({
4851 data : oldLineExtend . data ,
4952 onUpdate : diffFile . notifyAll ,
5053 } ) }
51- { width > 0 &&
54+ { ( enableWrap ? true : width > 0 ) &&
5255 newLineExtend ?. data !== undefined &&
5356 newLineExtend ?. data !== null &&
5457 renderExtendLine ?.( {
@@ -68,10 +71,12 @@ export const DiffUnifiedExtendLine = ({
6871 index,
6972 diffFile,
7073 lineNumber,
74+ enableWrap,
7175} : {
7276 index : number ;
7377 diffFile : DiffFile ;
7478 lineNumber : number ;
79+ enableWrap : boolean ;
7580} ) => {
7681 const { useDiffContext } = useDiffViewContext ( ) ;
7782
@@ -96,6 +101,7 @@ export const DiffUnifiedExtendLine = ({
96101 index = { index }
97102 diffFile = { diffFile }
98103 lineNumber = { lineNumber }
104+ enableWrap = { enableWrap }
99105 oldLineExtend = { oldLineExtend }
100106 newLineExtend = { newLineExtend }
101107 />
0 commit comments