0
0
mirror of https://github.com/vim/vim.git synced 2025-08-26 20:03:41 -04:00

patch 9.1.1165: diff: regression with multi-file diff blocks

Problem:  Vim's diff block merging algorithm when doing a multi-file diff
          is buggy when two different diff hunks overlap a single
          existing diff block (after v9.1.0743)

Solution: fix a couple bugs in this logic:

1. Fix regression from v9.1.0743 where it's not correctly expanding the
   2nd overlap correctly, where it always expands without taking into
   account that this was always taken care of when the first overlap
   happened. Instead, we should only grow the 2nd overlap if it overhangs
   outside the existing diff block, and if we encounter a new overlapping
   diff block (due to overlap chaining).
2. When we expand a diff block to match the hunk size on the orig side
   (when handling the first overlap), we expand the same amount of lines
   in the new side. This is not sound if there exists a second overlap
   hunk that we haven't processed yet, and that hunk has different
   number of lines in orig/new. Fix this by doing the corresponding
   counter adjustment when handling 2nd/3rd/etc overlap by calculating
   the difference in lines between orig and new side.
   (Yee Cheng Chin)

closes: #16768

Signed-off-by: Yee Cheng Chin <ychin.git@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Yee Cheng Chin 2025-03-02 22:05:37 +01:00 committed by Christian Brabandt
parent 334a13bff7
commit bc08ceb755
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
8 changed files with 152 additions and 3 deletions

View File

@ -1826,7 +1826,22 @@ diff_read(
else
{
// second overlap of new block with existing block
dp->df_count[idx_new] += hunk->count_new;
// if this hunk has different orig/new counts, adjust
// the diff block size first. When we handled the first hunk we
// would have expanded it to fit, without knowing that this
// hunk exists
int orig_size_in_dp = MIN(hunk->count_orig,
dp->df_lnum[idx_orig] +
dp->df_count[idx_orig] - hunk->lnum_orig);
int size_diff = hunk->count_new - orig_size_in_dp;
dp->df_count[idx_new] += size_diff;
// grow existing block to include the overlap completely
off = hunk->lnum_new + hunk->count_new
- (dp->df_lnum[idx_new] + dp->df_count[idx_new]);
if (off > 0)
dp->df_count[idx_new] += off;
if ((dp->df_lnum[idx_new] + dp->df_count[idx_new] - 1)
> curtab->tp_diffbuf[idx_new]->b_ml.ml_line_count)
dp->df_count[idx_new] = curtab->tp_diffbuf[idx_new]->b_ml.ml_line_count
@ -1839,8 +1854,16 @@ diff_read(
- (dpl->df_lnum[idx_orig] + dpl->df_count[idx_orig]);
if (off < 0)
{
// new change ends in existing block, adjust the end
dp->df_count[idx_new] += -off;
// new change ends in existing block, adjust the end. We only
// need to do this once per block or we will over-adjust.
if (notset || dp != dpl)
{
// adjusting by 'off' here is only correct if
// there is not another hunk in this block. we
// adjust for this when we encounter a second
// overlap later.
dp->df_count[idx_new] += -off;
}
if ((dp->df_lnum[idx_new] + dp->df_count[idx_new] - 1)
> curtab->tp_diffbuf[idx_new]->b_ml.ml_line_count)
dp->df_count[idx_new] = curtab->tp_diffbuf[idx_new]->b_ml.ml_line_count

View File

@ -0,0 +1,20 @@
| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @19||+1&&| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @18||+1&&| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @18
| +0#0000e05#a8a8a8255@1|a+2#0000000#ff404010| +0&#ffd7ff255@21||+1&#ffffff0| +0#0000e05#a8a8a8255@1|w+2#0000000#ff404010| +0&#ffd7ff255@20||+1&#ffffff0| +0#0000e05#a8a8a8255@1|1+2#0000000#ff404010| +0&#ffd7ff255@20
| +0#0000e05#a8a8a8255@1|b+2#0000000#ff404010| +0&#ffd7ff255@21||+1&#ffffff0| +0#0000e05#a8a8a8255@1|x+2#0000000#ff404010| +0&#ffd7ff255@20||+1&#ffffff0| +0#0000e05#a8a8a8255@1|a+2#0000000#ff404010| +0&#ffd7ff255@20
| +0#0000e05#a8a8a8255@1|c+2#0000000#ff404010| +0&#ffd7ff255@21||+1&#ffffff0| +0#0000e05#a8a8a8255@1|y+2#0000000#ff404010| +0&#ffd7ff255@20||+1&#ffffff0| +0#0000e05#a8a8a8255@1|b+2#0000000#ff404010| +0&#ffd7ff255@20
| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@22||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|z+2#0000000#ff404010| +0&#ffd7ff255@20||+1&#ffffff0| +0#0000e05#a8a8a8255@1|2+2#0000000#ff404010| +0&#ffd7ff255@20
| +0#0000e05#a8a8a8255@1|b+0#0000000#ffffff0|a|r| @19||+1&&| +0#0000e05#a8a8a8255@1|b+0#0000000#ffffff0|a|r| @18||+1&&| +0#0000e05#a8a8a8255@1|b+0#0000000#ffffff0|a|r| @18
|~+0#4040ff13&| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|X+3#0000000&|d|i|f|i|l|e|1| @4|1|,|1| @5|A|l@1| |X+1&&|d|i|f|i|l|e|2| @3|1|,|1| @5|A|l@1| |X|d|i|f|i|l|e|3| @3|1|,|1| @5|A|l@1
|:+0&&> @73

View File

@ -0,0 +1,20 @@
| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @19||+1&&| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @18||+1&&| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @18
| +0#0000e05#a8a8a8255@1|a+2#0000000#ff404010| +0&#ffd7ff255@21||+1&#ffffff0| +0#0000e05#a8a8a8255@1|w+2#0000000#ff404010| +0&#ffd7ff255@20||+1&#ffffff0| +0#0000e05#a8a8a8255@1|1+2#0000000#ff404010| +0&#ffd7ff255@20
| +0#0000e05#a8a8a8255@1|b+2#0000000#ff404010| +0&#ffd7ff255@21||+1&#ffffff0| +0#0000e05#a8a8a8255@1|x+2#0000000#ff404010| +0&#ffd7ff255@20||+1&#ffffff0| +0#0000e05#a8a8a8255@1|a+2#0000000#ff404010| +0&#ffd7ff255@20
| +0#0000e05#a8a8a8255@1|c+2#0000000#ff404010| +0&#ffd7ff255@21||+1&#ffffff0| +0#0000e05#a8a8a8255@1|y+2#0000000#ff404010| +0&#ffd7ff255@20||+1&#ffffff0| +0#0000e05#a8a8a8255@1|b+2#0000000#ff404010| +0&#ffd7ff255@20
| +0#0000e05#a8a8a8255@1|d+2#0000000#ff404010| +0&#ffd7ff255@21||+1&#ffffff0| +0#0000e05#a8a8a8255@1|z+2#0000000#ff404010| +0&#ffd7ff255@20||+1&#ffffff0| +0#0000e05#a8a8a8255@1|2+2#0000000#ff404010| +0&#ffd7ff255@20
| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@22||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|u+2#0000000#ff404010| +0&#ffd7ff255@20||+1&#ffffff0| +0#0000e05#a8a8a8255@1|d+2#0000000#ff404010| +0&#ffd7ff255@20
| +0#0000e05#a8a8a8255@1|b+0#0000000#ffffff0|a|r| @19||+1&&| +0#0000e05#a8a8a8255@1|b+0#0000000#ffffff0|a|r| @18||+1&&| +0#0000e05#a8a8a8255@1|b+0#0000000#ffffff0|a|r| @18
|~+0#4040ff13&| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|X+3#0000000&|d|i|f|i|l|e|1| @4|1|,|1| @5|A|l@1| |X+1&&|d|i|f|i|l|e|2| @3|1|,|1| @5|A|l@1| |X|d|i|f|i|l|e|3| @3|1|,|1| @5|A|l@1
|:+0&&> @73

View File

@ -0,0 +1,20 @@
| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @19||+1&&| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @18||+1&&| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @18
| +0#0000e05#a8a8a8255@1|a+2#0000000#ff404010| +0&#ffd7ff255@21||+1&#ffffff0| +0#0000e05#a8a8a8255@1|w+2#0000000#ff404010| +0&#ffd7ff255@20||+1&#ffffff0| +0#0000e05#a8a8a8255@1|1+2#0000000#ff404010| +0&#ffd7ff255@20
| +0#0000e05#a8a8a8255@1|b+2#0000000#ff404010| +0&#ffd7ff255@21||+1&#ffffff0| +0#0000e05#a8a8a8255@1|x+2#0000000#ff404010| +0&#ffd7ff255@20||+1&#ffffff0| +0#0000e05#a8a8a8255@1|b+2#0000000#ff404010| +0&#ffd7ff255@20
| +0#0000e05#a8a8a8255@1|c+2#0000000#ff404010| +0&#ffd7ff255@21||+1&#ffffff0| +0#0000e05#a8a8a8255@1|y+2#0000000#ff404010| +0&#ffd7ff255@20||+1&#ffffff0| +0#0000e05#a8a8a8255@1|2+2#0000000#ff404010| +0&#ffd7ff255@20
| +0#0000e05#a8a8a8255@1|d+2#0000000#ff404010| +0&#ffd7ff255@21||+1&#ffffff0| +0#0000e05#a8a8a8255@1|z+2#0000000#ff404010| +0&#ffd7ff255@20||+1&#ffffff0| +0#0000e05#a8a8a8255@1|3+2#0000000#ff404010| +0&#ffd7ff255@20
| +0#0000e05#a8a8a8255@1|e+2#0000000#ff404010| +0&#ffd7ff255@21||+1&#ffffff0| +0#0000e05#a8a8a8255@1|e+2#0000000#ff404010| +0&#ffd7ff255@20||+1&#ffffff0| +0#0000e05#a8a8a8255@1|d+2#0000000#ff404010| +0&#ffd7ff255@20
| +0#0000e05#a8a8a8255@1|f+2#0000000#ff404010| +0&#ffd7ff255@21||+1&#ffffff0| +0#0000e05#a8a8a8255@1|u+2#0000000#ff404010| +0&#ffd7ff255@20||+1&#ffffff0| +0#0000e05#a8a8a8255@1|4+2#0000000#ff404010| +0&#ffd7ff255@20
| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@22||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@21||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|f+0#0000000#5fd7ff255| @20
| +0#0000e05#a8a8a8255@1|b+0#0000000#ffffff0|a|r| @19||+1&&| +0#0000e05#a8a8a8255@1|b+0#0000000#ffffff0|a|r| @18||+1&&| +0#0000e05#a8a8a8255@1|b+0#0000000#ffffff0|a|r| @18
|~+0#4040ff13&| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|X+3#0000000&|d|i|f|i|l|e|1| @4|1|,|1| @5|A|l@1| |X+1&&|d|i|f|i|l|e|2| @3|1|,|1| @5|A|l@1| |X|d|i|f|i|l|e|3| @3|1|,|1| @5|A|l@1
|:+0&&> @73

View File

@ -0,0 +1,20 @@
| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @19||+1&&| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @18||+1&&| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @18
| +0#0000e05#a8a8a8255@1|a+2#0000000#ff404010| +0&#ffd7ff255@21||+1&#ffffff0| +0#0000e05#a8a8a8255@1|x+2#0000000#ff404010| +0&#ffd7ff255@20||+1&#ffffff0| +0#0000e05#a8a8a8255@1|1+2#0000000#ff404010| +0&#ffd7ff255@20
| +0#0000e05#a8a8a8255@1|b+2#0000000#ff404010| +0&#ffd7ff255@21||+1&#ffffff0| +0#0000e05#a8a8a8255@1|y+2#0000000#ff404010| +0&#ffd7ff255@20||+1&#ffffff0| +0#0000e05#a8a8a8255@1|a+2#0000000#ff404010| +0&#ffd7ff255@20
| +0#0000e05#a8a8a8255@1|b+0#0000000#ffffff0|a|r| @19||+1&&| +0#0000e05#a8a8a8255@1|b+0#0000000#ffffff0|a|r| @18||+1&&| +0#0000e05#a8a8a8255@1|b+0#0000000#ffffff0|a|r| @18
|~+0#4040ff13&| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|X+3#0000000&|d|i|f|i|l|e|1| @4|1|,|1| @5|A|l@1| |X+1&&|d|i|f|i|l|e|2| @3|1|,|1| @5|A|l@1| |X|d|i|f|i|l|e|3| @3|1|,|1| @5|A|l@1
|:+0&&> @73

View File

@ -0,0 +1,20 @@
| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @19||+1&&| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @18||+1&&| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @18
| +0#0000e05#a8a8a8255@1|a+2#0000000#ff404010| +0&#ffd7ff255@21||+1&#ffffff0| +0#0000e05#a8a8a8255@1|w+2#0000000#ff404010| +0&#ffd7ff255@20||+1&#ffffff0| +0#0000e05#a8a8a8255@1|1+2#0000000#ff404010| +0&#ffd7ff255@20
| +0#0000e05#a8a8a8255@1|b+2#0000000#ff404010| +0&#ffd7ff255@21||+1&#ffffff0| +0#0000e05#a8a8a8255@1|x+2#0000000#ff404010| +0&#ffd7ff255@20||+1&#ffffff0| +0#0000e05#a8a8a8255@1|a+2#0000000#ff404010| +0&#ffd7ff255@20
| +0#0000e05#a8a8a8255@1|c+2#0000000#ff404010| +0&#ffd7ff255@21||+1&#ffffff0| +0#0000e05#a8a8a8255@1|y+2#0000000#ff404010| +0&#ffd7ff255@20||+1&#ffffff0| +0#0000e05#a8a8a8255@1|b+2#0000000#ff404010| +0&#ffd7ff255@20
| +0#0000e05#a8a8a8255@1|d+2#0000000#ff404010| +0&#ffd7ff255@21||+1&#ffffff0| +0#0000e05#a8a8a8255@1|z+2#0000000#ff404010| +0&#ffd7ff255@20||+1&#ffffff0| +0#0000e05#a8a8a8255@1|3+2#0000000#ff404010| +0&#ffd7ff255@20
| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@22||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|u+2#0000000#ff404010| +0&#ffd7ff255@20||+1&#ffffff0| +0#0000e05#a8a8a8255@1|4+2#0000000#ff404010| +0&#ffd7ff255@20
| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@22||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@21||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|d+0#0000000#5fd7ff255| @20
| +0#0000e05#a8a8a8255@1|b+0#0000000#ffffff0|a|r| @19||+1&&| +0#0000e05#a8a8a8255@1|b+0#0000000#ffffff0|a|r| @18||+1&&| +0#0000e05#a8a8a8255@1|b+0#0000000#ffffff0|a|r| @18
|~+0#4040ff13&| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|~| @23||+1#0000000&|~+0#4040ff13&| @22||+1#0000000&|~+0#4040ff13&| @22
|X+3#0000000&|d|i|f|i|l|e|1| @4|1|,|1| @5|A|l@1| |X+1&&|d|i|f|i|l|e|2| @3|1|,|1| @5|A|l@1| |X|d|i|f|i|l|e|3| @3|1|,|1| @5|A|l@1
|:+0&&> @73

View File

@ -2296,6 +2296,30 @@ func Test_diff_overlapped_diff_blocks_will_be_merged()
call WriteDiffFiles3(buf, ["a", "b", "c"], ["d", "e"], ["b"])
call VerifyBoth(buf, "Test_diff_overlapped_3.39", "")
" File 3 overlaps twice, 2nd overlap completely within the existing block.
call WriteDiffFiles3(buf, ["foo", "a", "b", "c", "bar"], ["foo", "w", "x", "y", "z", "bar"], ["foo", "1", "a", "b", "2", "bar"])
call VerifyBoth(buf, "Test_diff_overlapped_3.40", "")
" File 3 overlaps twice, 2nd overlap extends beyond existing block on new
" side. Make sure we don't over-extend the range and hit 'bar'.
call WriteDiffFiles3(buf, ["foo", "a", "b", "c", "d", "bar"], ["foo", "w", "x", "y", "z", "u", "bar"], ["foo", "1", "a", "b", "2", "d", "bar"])
call VerifyBoth(buf, "Test_diff_overlapped_3.41", "")
" Chained overlaps. File 3's 2nd overlap spans two diff blocks and is longer
" than the 2nd one.
call WriteDiffFiles3(buf, ["foo", "a", "b", "c", "d", "e", "f", "bar"], ["foo", "w", "x", "y", "z", "e", "u", "bar"], ["foo", "1", "b", "2", "3", "d", "4", "f", "bar"])
call VerifyBoth(buf, "Test_diff_overlapped_3.42", "")
" File 3 has 2 overlaps. An add and a delete. First overlap's expansion hits
" the 2nd one. Make sure we adjust the diff block to have fewer lines.
call WriteDiffFiles3(buf, ["foo", "a", "b", "bar"], ["foo", "x", "y", "bar"], ["foo", "1", "a", "bar"])
call VerifyBoth(buf, "Test_diff_overlapped_3.43", "")
" File 3 has 2 overlaps. An add and another add. First overlap's expansion hits
" the 2nd one. Make sure we adjust the diff block to have more lines.
call WriteDiffFiles3(buf, ["foo", "a", "b", "c", "d", "bar"], ["foo", "w", "x", "y", "z", "u", "bar"], ["foo", "1", "a", "b", "3", "4", "d", "bar"])
call VerifyBoth(buf, "Test_diff_overlapped_3.44", "")
call StopVimInTerminal(buf)
endfunc

View File

@ -704,6 +704,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1165,
/**/
1164,
/**/