@@ -166,6 +166,7 @@ const Viewer: React.FC<ViewerProps> = props => {
166166 const scrollContainer = _scrollContainer === 'body'
167167 ? document . body
168168 : document . querySelector ( _scrollContainer ) ;
169+ const totalColumns = props . lineNumbers ? 4 : 2 ;
169170
170171 // Use these refs to keep the diff data and segments sync,
171172 // or it may cause runtime error because of their mismatch.
@@ -412,7 +413,7 @@ const Viewer: React.FC<ViewerProps> = props => {
412413 return [
413414 < tr key = { `expand-line-${ index } ` } className = "expand-line" >
414415 < td
415- colSpan = { 4 }
416+ colSpan = { totalColumns }
416417 className = { `${ hasLinesBefore ? 'has-lines-before' : '' } ${ hasLinesAfter ? 'has-lines-after' : '' } ` }
417418 >
418419 {
@@ -435,7 +436,7 @@ const Viewer: React.FC<ViewerProps> = props => {
435436 if ( jsonsAreEqual && hideUnchangedLines ) {
436437 return (
437438 < tr key = "message-line" className = "message-line" >
438- < td colSpan = { 4 } >
439+ < td colSpan = { totalColumns } >
439440 { mergedTexts . noChangeDetected }
440441 </ td >
441442 </ tr >
@@ -460,7 +461,7 @@ const Viewer: React.FC<ViewerProps> = props => {
460461 if ( firstElementTop > scrollBottom || firstElementTop + totalHeightRef . current < scrollTop ) {
461462 return (
462463 < tr >
463- < td colSpan = { 4 } style = { { height : `${ totalHeightRef . current } px` } } />
464+ < td colSpan = { totalColumns } style = { { height : `${ totalHeightRef . current } px` } } />
464465 </ tr >
465466 ) ;
466467 }
@@ -493,17 +494,17 @@ const Viewer: React.FC<ViewerProps> = props => {
493494 const visibleSegments = segmentsRef . current . slice ( startSegment , endSegment + 1 ) ;
494495 return visibleSegments . length ? (
495496 < >
496- < tr > < td colSpan = { 4 } style = { { height : topHeight , padding : 0 } } /> </ tr >
497+ < tr > < td colSpan = { totalColumns } style = { { height : topHeight , padding : 0 } } /> </ tr >
497498 {
498499 visibleSegments . map ( ( segment , index ) => (
499500 renderSegment ( segment , index , startLine , endLine , syntaxHighlightEnabled )
500501 ) )
501502 }
502- < tr > < td colSpan = { 4 } style = { { height : bottomHeight , padding : 0 } } /> </ tr >
503+ < tr > < td colSpan = { totalColumns } style = { { height : bottomHeight , padding : 0 } } /> </ tr >
503504 </ >
504505 ) : (
505506 < tr >
506- < td colSpan = { 4 } style = { { height : `${ totalHeightRef . current } px` } } />
507+ < td colSpan = { totalColumns } style = { { height : `${ totalHeightRef . current } px` } } />
507508 </ tr >
508509 ) ;
509510 } ;
0 commit comments