diff options
author | Lewis Russell <lewis6991@gmail.com> | 2022-03-06 21:45:26 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-06 22:45:26 +0100 |
commit | 8e7446b3cbc5c82706f41d701239fa18ab5b2808 (patch) | |
tree | a017f9b8440060f6597b183d1b297f0facb69f2f /src/nvim/decoration.c | |
parent | 54000170205b684cfb91bd178fba5d3486fb3313 (diff) | |
download | rneovim-8e7446b3cbc5c82706f41d701239fa18ab5b2808.tar.gz rneovim-8e7446b3cbc5c82706f41d701239fa18ab5b2808.tar.bz2 rneovim-8e7446b3cbc5c82706f41d701239fa18ab5b2808.zip |
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.
Diffstat (limited to 'src/nvim/decoration.c')
-rw-r--r-- | src/nvim/decoration.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/nvim/decoration.c b/src/nvim/decoration.c index 6c006b7fe0..619e8fdadc 100644 --- a/src/nvim/decoration.c +++ b/src/nvim/decoration.c @@ -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); } |