mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 06:28:35 +00:00
fix(column): clamp line number for legacy signs
Problem: Legacy :sign API still allows placing signs beyond the end of the buffer. This is unaccounted for by the signcolumn tracking logic and is disallowed in general for the extmark API which implements it now. Solution: Clamp legacy sign line number to the length of the buffer.
This commit is contained in:
@@ -126,8 +126,8 @@ static void buf_set_sign(buf_T *buf, uint32_t *id, char *group, int prio, linenr
|
||||
| (has_hl ? MT_FLAG_DECOR_SIGNHL : 0);
|
||||
|
||||
DecorInline decor = { .ext = true, .data.ext = { .vt = NULL, .sh_idx = decor_put_sh(sign) } };
|
||||
extmark_set(buf, ns, id, lnum - 1, 0, -1, -1, decor, decor_flags, true,
|
||||
false, true, true, NULL);
|
||||
extmark_set(buf, ns, id, MIN(buf->b_ml.ml_line_count, lnum) - 1, 0, -1, -1,
|
||||
decor, decor_flags, true, false, true, true, NULL);
|
||||
}
|
||||
|
||||
/// For an existing, placed sign with "id", modify the sign, group or priority.
|
||||
|
Reference in New Issue
Block a user