File tree 1 file changed +8
-8
lines changed
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
146
146
$ oldBlock = $ this ->formatLines (array_slice ($ oldText , $ startOld , $ blockSizeOld ));
147
147
$ newBlock = $ this ->formatLines (array_slice ($ newText , $ startNew , $ blockSizeNew ));
148
148
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.
151
151
$ blocks [$ lastBlock ]['base ' ]['lines ' ] += $ oldBlock ;
152
152
$ blocks [$ lastBlock ]['changed ' ]['lines ' ] += $ newBlock ;
153
153
continue ;
154
154
}
155
155
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 .
158
158
$ blocks [$ lastBlock ]['base ' ]['lines ' ] += $ oldBlock ;
159
+ continue ;
159
160
}
160
161
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 ;
165
164
}
165
+
166
166
$ changes [] = $ blocks ;
167
167
}
168
168
You can’t perform that action at this time.
0 commit comments