0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 9.1.1018: v9.1.0743 causes regression with diff mode

Problem:  v9.1.0743 causes regression with diff mode
Solution: Fix the regression with overlapping regions

closes: #16454

Signed-off-by: Yukihiro Nakadaira <yukihiro.nakadaira@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Yukihiro Nakadaira
2025-01-15 18:36:43 +01:00
committed by Christian Brabandt
parent 6472e58365
commit 01f6509fb2
5 changed files with 58 additions and 0 deletions

View File

@@ -1824,8 +1824,14 @@ diff_read(
dp->df_count[idx_new] = hunk->count_new - off;
}
else
{
// second overlap of new block with existing block
dp->df_count[idx_new] += hunk->count_new;
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
- dp->df_lnum[idx_new] + 1;
}
// Adjust the size of the block to include all the lines to the
// end of the existing block or the new diff, whatever ends last.
@@ -1835,6 +1841,10 @@ diff_read(
{
// new change ends in existing block, adjust the end
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
- dp->df_lnum[idx_new] + 1;
off = 0;
}
for (i = idx_orig; i < idx_new; ++i)