File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -146,23 +146,23 @@ protected function renderSequences(): array
146146 $ oldBlock = $ this ->formatLines (array_slice ($ oldText , $ startOld , $ blockSizeOld ));
147147 $ newBlock = $ this ->formatLines (array_slice ($ newText , $ startNew , $ blockSizeNew ));
148148
149- if ($ tag = = 'equal ' ) {
150- // Old block equals New block
149+ if ($ tag != ' delete ' && $ tag ! = 'insert ' ) {
150+ // Old block " equals" New block or is replaced.
151151 $ blocks [$ lastBlock ]['base ' ]['lines ' ] += $ oldBlock ;
152152 $ blocks [$ lastBlock ]['changed ' ]['lines ' ] += $ newBlock ;
153153 continue ;
154154 }
155155
156- if ($ tag == 'replace ' || $ tag == ' delete ' ) {
157- // Inline differences or old block doesn't exist in the new text .
156+ if ($ tag == 'delete ' ) {
157+ // Block of version1 doesn't exist in version2 .
158158 $ blocks [$ lastBlock ]['base ' ]['lines ' ] += $ oldBlock ;
159+ continue ;
159160 }
160161
161- if ($ tag == 'replace ' || $ tag == 'insert ' ) {
162- // Inline differences or the new block doesn't exist in the old text.
163- $ blocks [$ lastBlock ]['changed ' ]['lines ' ] += $ newBlock ;
164- }
162+ // Block of version2 doesn't exist in version1.
163+ $ blocks [$ lastBlock ]['changed ' ]['lines ' ] += $ newBlock ;
165164 }
165+
166166 $ changes [] = $ blocks ;
167167 }
168168
You can’t perform that action at this time.
0 commit comments