@@ -115,7 +115,7 @@ class Pair {
115115 }
116116}
117117
118- class Side {
118+ class DiffOutput {
119119 constructor ( args = { } ) {
120120 Object . assign ( this , Object . assign ( {
121121 outputLines : [ ]
@@ -129,6 +129,12 @@ class Side {
129129 padLines ( number ) {
130130 while ( number -- > 0 ) this . outputLines . push ( bgColor ( repeatChar ( ' ' , colwidth ) ) )
131131 }
132+ }
133+
134+ class HunkHeader extends DiffOutput {
135+ constructor ( args = { } ) {
136+ super ( args )
137+ }
132138 addLine ( rawLine ) {
133139 Array . prototype . push . apply (
134140 this . outputLines ,
@@ -143,9 +149,9 @@ class Side {
143149 }
144150}
145151
146- class SideLines extends Side {
152+ class HunkContent extends DiffOutput {
147153 constructor ( args ) {
148- super ( )
154+ super ( args )
149155 Object . assign ( this , Object . assign ( {
150156 lineLength : 0 ,
151157 currentLineNumber : 0 ,
@@ -200,13 +206,13 @@ module.exports = {
200206 let theDiff = diff [ diffType ] ( one , two )
201207
202208 let pair = new Pair (
203- new SideLines ( {
209+ new HunkContent ( {
204210 lineLength : one . split ( '\n' ) . length ,
205211 currentLineNumber : - lineOffset ,
206212 changedLineColor : chalk . bgRgb ( 70 , 0 , 0 ) ,
207213 changedLineNumberColor : chalk . bgRgb ( 50 , 0 , 0 )
208214 } ) ,
209- new SideLines ( {
215+ new HunkContent ( {
210216 lineLength : two . split ( '\n' ) . length ,
211217 currentLineNumber : - lineOffset ,
212218 changedLineColor : chalk . bgRgb ( 0 , 70 , 0 ) ,
@@ -299,8 +305,8 @@ module.exports = {
299305
300306 for ( let patch of parsedPatch ) {
301307 let pair = new Pair (
302- new Side ( ) ,
303- new Side ( )
308+ new HunkHeader ( ) ,
309+ new HunkHeader ( )
304310 )
305311
306312 pair . addLines ( patch . oldFileName , patch . newFileName )
@@ -311,13 +317,13 @@ module.exports = {
311317 let hunkSize = 0
312318
313319 let pair = new Pair (
314- new SideLines ( {
320+ new HunkContent ( {
315321 currentLineNumber : hunk . oldStart ,
316322 lineLength : hunk . oldStart + hunk . oldLines ,
317323 changedLineColor : chalk . bgRgb ( 70 , 0 , 0 ) ,
318324 changedLineNumberColor : chalk . bgRgb ( 50 , 0 , 0 )
319325 } ) ,
320- new SideLines ( {
326+ new HunkContent ( {
321327 currentLineNumber : hunk . newStart ,
322328 lineLength : hunk . newStart + hunk . newLines ,
323329 changedLineColor : chalk . bgRgb ( 0 , 70 , 0 ) ,
0 commit comments