fix(column): redraw and update signcols for paired extmark

Problem:  Signcolumn width does not increase when ranged sign does not
          start at sentinel line.
Solution: Handle paired range of added sign when checking signcols.
This commit is contained in:
Luuk van Baal
2023-11-27 16:22:19 +01:00
committed by Lewis Russell
parent adb2258345
commit 35cec0de4a
4 changed files with 18 additions and 35 deletions

View File

@@ -4055,7 +4055,7 @@ void buf_signcols_del_check(buf_T *buf, linenr_T line1, linenr_T line2)
///
/// @param buf buffer to check
/// @param added sign being added
void buf_signcols_add_check(buf_T *buf, linenr_T lnum)
void buf_signcols_add_check(buf_T *buf, linenr_T line1, linenr_T line2)
{
if (!buf->b_signcols.valid) {
return;
@@ -4066,7 +4066,9 @@ void buf_signcols_add_check(buf_T *buf, linenr_T lnum)
return;
}
if (lnum == buf->b_signcols.sentinel) {
linenr_T sent = buf->b_signcols.sentinel;
if (sent >= line1 && sent <= line2) {
if (buf->b_signcols.size == buf->b_signcols.max) {
buf->b_signcols.max++;
}
@@ -4075,12 +4077,11 @@ void buf_signcols_add_check(buf_T *buf, linenr_T lnum)
return;
}
int signcols = decor_signcols(buf, lnum - 1, lnum - 1, SIGN_SHOW_MAX);
int signcols = decor_signcols(buf, line1 - 1, line2 - 1, SIGN_SHOW_MAX);
if (signcols > buf->b_signcols.size) {
buf->b_signcols.size = signcols;
buf->b_signcols.max = signcols;
buf->b_signcols.sentinel = lnum;
redraw_buf_later(buf, UPD_NOT_VALID);
}
}