fix(column): don't count signs on lines beyond eob #33410

Problem:  Computed previous buffer line count may be beyond end of
          buffer. This results in signs being removed from `b_signcols`
          that were never included in it, tripping an assertion.

Solution: Store the previous line count as it was before appending or
          deleting lines. Use it to clamp the edited region when
          clearing signs before a splice, after which it is reset.
This commit is contained in:
luukvbaal
2025-04-11 13:46:55 +02:00
committed by GitHub
parent 064ff74cdb
commit 4a706a7092
4 changed files with 21 additions and 2 deletions

View File

@@ -580,8 +580,9 @@ void extmark_splice_impl(buf_T *buf, int start_row, colnr_T start_col, bcount_t
// Remove signs inside edited region from "b_signcols.count", add after splicing.
if (old_row > 0 || new_row > 0) {
int row2 = MIN(buf->b_ml.ml_line_count - (new_row - old_row) - 1, start_row + old_row);
buf_signcols_count_range(buf, start_row, row2, 0, kTrue);
int count = buf->b_prev_line_count > 0 ? buf->b_prev_line_count : buf->b_ml.ml_line_count;
buf_signcols_count_range(buf, start_row, MIN(count - 1, start_row + old_row), 0, kTrue);
buf->b_prev_line_count = 0;
}
marktree_splice(buf->b_marktree, (int32_t)start_row, start_col,