@@ -129,6 +129,8 @@ export class DiffFile {
129129
130130 unifiedLineLength : number = 0 ;
131131
132+ fileLineLength : number = 0 ;
133+
132134 hasExpandSplitAll : boolean = false ;
133135
134136 hasExpandUnifiedAll : boolean = false ;
@@ -210,10 +212,14 @@ export class DiffFile {
210212
211213 if ( this . _oldFileContent ) {
212214 this . #oldFileResult = getFile ( this . _oldFileContent , this . _oldFileLang , this . _oldFileName ) ;
215+
216+ this . fileLineLength = Math . max ( this . fileLineLength , this . #oldFileResult. maxLineNumber ) ;
213217 }
214218
215219 if ( this . _newFileContent ) {
216220 this . #newFileResult = getFile ( this . _newFileContent , this . _newFileLang , this . _newFileName ) ;
221+
222+ this . fileLineLength = Math . max ( this . fileLineLength , this . #newFileResult. maxLineNumber ) ;
217223 }
218224 }
219225
@@ -271,6 +277,11 @@ export class DiffFile {
271277 this . #newFileResult = getFile ( this . _newFileContent , this . _newFileLang , this . _newFileName ) ;
272278 this . #oldFilePlaceholderLines = oldFilePlaceholderLines ;
273279 this . #newFilePlaceholderLines = newFilePlaceholderLines ;
280+ this . fileLineLength = Math . max (
281+ this . fileLineLength ,
282+ this . #oldFileResult. maxLineNumber ,
283+ this . #newFileResult. maxLineNumber
284+ ) ;
274285 // all of the file just compose by diff, so we can not do the expand action
275286 this . #composeByDiff = true ;
276287 } else if ( this . #oldFileResult) {
@@ -297,6 +308,7 @@ export class DiffFile {
297308 if ( ! hasSymbolChanged && newFileContent === this . _oldFileContent ) return ;
298309 this . _newFileContent = newFileContent ;
299310 this . #newFileResult = getFile ( this . _newFileContent , this . _newFileLang , this . _newFileName ) ;
311+ this . fileLineLength = Math . max ( this . fileLineLength , this . #newFileResult. maxLineNumber ) ;
300312 } else if ( this . #newFileResult) {
301313 let oldLineNumber = 1 ;
302314 let newLineNumber = 1 ;
@@ -321,6 +333,7 @@ export class DiffFile {
321333 if ( ! hasSymbolChanged && oldFileContent === this . _newFileContent ) return ;
322334 this . _oldFileContent = oldFileContent ;
323335 this . #oldFileResult = getFile ( this . _oldFileContent , this . _oldFileLang , this . _oldFileName ) ;
336+ this . fileLineLength = Math . max ( this . fileLineLength , this . #oldFileResult. maxLineNumber ) ;
324337 }
325338
326339 this . #composeRaw( ) ;
@@ -1133,6 +1146,7 @@ export class DiffFile {
11331146 const newFilePlaceholderLines = this . #newFilePlaceholderLines;
11341147 const splitLineLength = this . splitLineLength ;
11351148 const unifiedLineLength = this . unifiedLineLength ;
1149+ const fileLineLength = this . fileLineLength ;
11361150 const composeByDiff = this . #composeByDiff;
11371151 const highlighterName = this . #highlighterName;
11381152 const hasSomeLineCollapsed = this . hasSomeLineCollapsed ;
@@ -1163,6 +1177,7 @@ export class DiffFile {
11631177 newFilePlaceholderLines,
11641178 splitLineLength,
11651179 unifiedLineLength,
1180+ fileLineLength,
11661181 splitLeftLines,
11671182 splitRightLines,
11681183 splitHunkLines,
@@ -1197,6 +1212,7 @@ export class DiffFile {
11971212 this . #newFilePlaceholderLines = data . newFilePlaceholderLines ;
11981213 this . splitLineLength = data . splitLineLength ;
11991214 this . unifiedLineLength = data . unifiedLineLength ;
1215+ this . fileLineLength = data . fileLineLength ;
12001216 this . hasSomeLineCollapsed = data . hasSomeLineCollapsed ;
12011217
12021218 this . #splitLeftLines = data . splitLeftLines ;
0 commit comments