vim-patch:9.1.1018: v9.1.0743 causes regression with diff mode (#32047)

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

closes: vim/vim#16454

01f6509fb2

Co-authored-by: Yukihiro Nakadaira <yukihiro.nakadaira@gmail.com>
This commit is contained in:
zeertzjq
2025-01-16 09:16:25 +08:00
committed by GitHub
parent 524be56042
commit 718e165360
3 changed files with 36 additions and 0 deletions

View File

@@ -1622,6 +1622,11 @@ static void process_hunk(diff_T **dpp, diff_T **dprevp, int idx_orig, int idx_ne
} else {
// second overlap of new block with existing block
dp->df_count[idx_new] += (linenr_T)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
@@ -1632,6 +1637,11 @@ static void process_hunk(diff_T **dpp, diff_T **dprevp, int idx_orig, int idx_ne
if (off < 0) {
// 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;
}