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:
Lewis Russell
2022-03-06 21:45:26 +00:00
committed by GitHub
parent 5400017020
commit 8e7446b3cb
5 changed files with 107 additions and 23 deletions

View File

@@ -862,9 +862,12 @@ struct file_buffer {
// may use a different synblock_T.
sign_entry_T *b_signlist; // list of placed signs
int b_signcols; // last calculated number of sign columns
bool b_signcols_valid; // calculated sign columns is valid
int b_signcols_max; // Maximum value b_signcols is valid for.
struct {
int size; // last calculated number of sign columns
bool valid; // calculated sign columns is valid
linenr_T sentinel; // a line number which is holding up the signcolumn
int max; // Maximum value size is valid for.
} b_signcols;
Terminal *terminal; // Terminal instance associated with the buffer