mirror of
https://github.com/neovim/neovim.git
synced 2025-10-16 06:46:07 +00:00
refactor(signcol): smarter invalidation (#17533)
Previously b_signcols was invalidated whenever a sign was added/removed or when a buffer line was added/removed. This change introduces a sentinel linenr_T into the buffer state which is a line number used to determine the signcolumn. With this information, we can invalidate the signcolumn less often. Now the signcolumn is only invalidated when a sign or line at the sentinel line number is removed.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// This is an open source non-commercial project. Dear PVS-Studio, please check
|
||||
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
|
||||
|
||||
#include "nvim/buffer.h"
|
||||
#include "nvim/decoration.h"
|
||||
#include "nvim/extmark.h"
|
||||
#include "nvim/highlight.h"
|
||||
@@ -67,11 +68,6 @@ void bufhl_add_hl_pos_offset(buf_T *buf, int src_id, int hl_id, lpos_T pos_start
|
||||
void decor_redraw(buf_T *buf, int row1, int row2, Decoration *decor)
|
||||
{
|
||||
if (row2 >= row1) {
|
||||
if (decor && decor->sign_text) {
|
||||
buf->b_signcols_valid = false;
|
||||
changed_line_abv_curs();
|
||||
}
|
||||
|
||||
if (!decor || decor->hl_id || decor_has_sign(decor)) {
|
||||
redraw_buf_range_later(buf, row1+1, row2+1);
|
||||
}
|
||||
@@ -99,6 +95,9 @@ void decor_remove(buf_T *buf, int row, int row2, Decoration *decor)
|
||||
assert(buf->b_signs > 0);
|
||||
buf->b_signs--;
|
||||
}
|
||||
if (row2 >= row && decor->sign_text) {
|
||||
buf_signcols_del_check(buf, row+1, row2+1);
|
||||
}
|
||||
}
|
||||
decor_free(decor);
|
||||
}
|
||||
|
Reference in New Issue
Block a user