From e67cd22c38493d4dff90f6afa17bfeacd0ba953d Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Sun, 20 Feb 2022 17:26:39 +0000 Subject: fix(signcol): handle edge case with maximum value 50250542 failed to consider that the maximum passed to buf_signcols is window scoped whereas the signcols value is buffer scoped. This can lead to a bug where the signcolumn becomes incorrect if: - global signcolumn is set to auto:N - signcolumn in a window is changed locally to auto:M where M > N - the buffer has a line with M or greater signs. --- src/nvim/buffer.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/nvim/buffer.c') diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index dd40623af2..9e82b4e80b 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -5495,11 +5495,19 @@ static int buf_signcols_inner(buf_T *buf, int maximum) int buf_signcols(buf_T *buf, int maximum) { + // The maximum can be determined from 'signcolumn' which is window scoped so + // need to invalidate signcols if the maximum is greater than the previous + // maximum. + if (maximum > buf->b_signcols_max) { + buf->b_signcols_valid = false; + } + if (!buf->b_signcols_valid) { int signcols = buf_signcols_inner(buf, maximum); // Check if we need to redraw if (signcols != buf->b_signcols) { buf->b_signcols = signcols; + buf->b_signcols_max = maximum; redraw_buf_later(buf, NOT_VALID); } -- cgit