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

@@ -2088,6 +2088,9 @@ static int ml_append_int(buf_T *buf, linenr_T lnum, char *line, colnr_T len, boo
dp = hp->bh_data;
}
if (buf->b_prev_line_count == 0) {
buf->b_prev_line_count = buf->b_ml.ml_line_count;
}
buf->b_ml.ml_line_count++;
if ((int)dp->db_free >= space_needed) { // enough room in data block
@@ -2573,6 +2576,9 @@ static int ml_delete_int(buf_T *buf, linenr_T lnum, bool message)
int count = buf->b_ml.ml_locked_high - buf->b_ml.ml_locked_low + 2;
int idx = lnum - buf->b_ml.ml_locked_low;
if (buf->b_prev_line_count == 0) {
buf->b_prev_line_count = buf->b_ml.ml_line_count;
}
buf->b_ml.ml_line_count--;
int line_start = ((dp->db_index[idx]) & DB_INDEX_MASK);