Skip to content

Commit be77f82

Browse files
committed
Add additional check that context lines aren't printed twice
1 parent 2b57a8e commit be77f82

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

run-tests.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2955,6 +2955,9 @@ function generate_array_diff(array $ar1, array $ar2, bool $is_reg, array $w): ar
29552955
$l2 = -2;
29562956
$old_k1 = -1;
29572957
$add_context_lines = function (int $new_k1) use (&$old_k1, &$diff, $w, $context_line_count, $format_context_line) {
2958+
if ($old_k1 >= $new_k1) {
2959+
return;
2960+
}
29582961
$end = $new_k1 - 1;
29592962
$range_end = min($end, $old_k1 + $context_line_count);
29602963
if ($old_k1 >= 0) {

0 commit comments

Comments
 (0)