diff options
author | luukvbaal <luukvbaal@gmail.com> | 2024-05-26 19:55:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-26 10:55:57 -0700 |
commit | 43a2019f09e855c4eae33bfdbdec4cc7b2985075 (patch) | |
tree | 2948276da26fa259d79c83f35d01cbaf58c294f8 /src | |
parent | bc63ffcf39e8ad6c0925c0ad8503bfb3ed8497f3 (diff) | |
download | rneovim-43a2019f09e855c4eae33bfdbdec4cc7b2985075.tar.gz rneovim-43a2019f09e855c4eae33bfdbdec4cc7b2985075.tar.bz2 rneovim-43a2019f09e855c4eae33bfdbdec4cc7b2985075.zip |
fix(extmarks): issues with revalidating marks #28961
Problem: Invalid marks appear to be revalidated multiple times, and
decor is added at the old position for unpaired marks.
Solution: Avoid revalidating already valid marks, and don't use old
position to add to decor for unpaired marks.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/extmark.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/nvim/extmark.c b/src/nvim/extmark.c index 3236590010..4e47fa76fe 100644 --- a/src/nvim/extmark.c +++ b/src/nvim/extmark.c @@ -117,9 +117,16 @@ static void extmark_setraw(buf_T *buf, uint64_t mark, int row, colnr_T col, bool MarkTreeIter itr[1] = { 0 }; MTKey key = marktree_lookup(buf->b_marktree, mark, itr); if (key.pos.row < 0 || (key.pos.row == row && key.pos.col == col)) { + // Does this hold? If it doesn't, we should still revalidate. + assert(!invalid || !mt_invalid(key)); return; } + // Key already revalidated(how?) Avoid adding to decor again. + if (invalid && !mt_invalid(key)) { + invalid = false; + } + // Only the position before undo needs to be redrawn here, // as the position after undo should be marked as changed. if (!invalid && mt_decor_any(key) && key.pos.row != row) { @@ -140,8 +147,8 @@ static void extmark_setraw(buf_T *buf, uint64_t mark, int row, colnr_T col, bool marktree_move(buf->b_marktree, itr, row, col); if (invalid) { - MTPos end = marktree_get_altpos(buf->b_marktree, key, NULL); - buf_put_decor(buf, mt_decor(key), row, end.row); + row2 = mt_paired(key) ? marktree_get_altpos(buf->b_marktree, key, NULL).row : row; + buf_put_decor(buf, mt_decor(key), row, row2); } else if (key.flags & MT_FLAG_DECOR_SIGNTEXT && buf->b_signcols.autom) { buf_signcols_count_range(buf, row1, row2, 0, kNone); } |