aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorluukvbaal <luukvbaal@gmail.com>2024-04-06 03:32:07 +0200
committerGitHub <noreply@github.com>2024-04-06 09:32:07 +0800
commit97122eaa1cbe8ca3d965c4fc25210796fe1bad4d (patch)
treeb2d0b5b484f82447175835398acfcb8a394d0e63 /src
parent5581a90e20777a2493ca9835b11a67435287d64e (diff)
downloadrneovim-97122eaa1cbe8ca3d965c4fc25210796fe1bad4d.tar.gz
rneovim-97122eaa1cbe8ca3d965c4fc25210796fe1bad4d.tar.bz2
rneovim-97122eaa1cbe8ca3d965c4fc25210796fe1bad4d.zip
fix(column): ignore empty signcols range (#28177)
Problem: Invalid assert for empty signcols range. The empty range should already be removed from "b_signcols" at this point. The "clear" == kTrue call before the splice that made the range empty will have removed it, and the "clear" == kNone call after the splice already ignores the empty range. Solution: Return early when "row2" < "row1".
Diffstat (limited to 'src')
-rw-r--r--src/nvim/decoration.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/nvim/decoration.c b/src/nvim/decoration.c
index 41ef1aceaf..716f3d19b9 100644
--- a/src/nvim/decoration.c
+++ b/src/nvim/decoration.c
@@ -792,12 +792,11 @@ static const uint32_t signtext_filter[4] = {[kMTMetaSignText] = kMTFilterSelect
/// @param clear kFalse, kTrue or kNone for an, added/deleted, cleared, or initialized range.
void buf_signcols_count_range(buf_T *buf, int row1, int row2, int add, TriState clear)
{
- if (!buf->b_signcols.autom || !buf_meta_total(buf, kMTMetaSignText)) {
+ if (!buf->b_signcols.autom || row2 < row1 || !buf_meta_total(buf, kMTMetaSignText)) {
return;
}
// Allocate an array of integers holding the number of signs in the range.
- assert(row2 >= row1);
int *count = xcalloc(sizeof(int), (size_t)(row2 + 1 - row1));
MarkTreeIter itr[1];
MTPair pair = { 0 };