mirror of
https://github.com/neovim/neovim.git
synced 2025-10-15 22:36:09 +00:00
fix(column): keep track of number of lines with number of signs
Problem: Some edge cases to the old (pre-#26406) and current "b_signcols" structure result in an incorrectly sized "auto" 'signcolumn'. Solution: * Implement a simpler 'signcolumn' validation strategy by immediately counting the number of signs in a range upon sign insertion and deletion. Decrease in performance here but there is a clear path forward to decreasing this performance hit by moving signs to a dedicated marktree, or by adding meta-data to the existing marktree which may be queried more efficiently? * Also replace "max_count" and keep track of the number of lines with a certain number of signs. This makes it so that it is no longer necessary to scan the entire buffer when the maximum number of signs decreases. This likely makes the commit a net increase in performance. * To ensure correctness we also have re-initialize the count for an edited region that spans multiple lines. Such an edit may move the signs within it. Thus we count and decrement before splicing the marktree and count and increment after.
This commit is contained in:

committed by
Lewis Russell

parent
4d91604c88
commit
967c7abde3
@@ -685,10 +685,12 @@ struct file_buffer {
|
||||
// may use a different synblock_T.
|
||||
|
||||
struct {
|
||||
int max; // maximum number of signs on a single line
|
||||
int max_count; // number of lines with max number of signs
|
||||
bool resized; // whether max changed at start of redraw
|
||||
Map(int, SignRange) invalid[1]; // map of invalid ranges to be checked
|
||||
int max; // maximum number of signs on a single line
|
||||
int count[SIGN_SHOW_MAX]; // number of lines with number of signs
|
||||
bool resized; // whether max changed at start of redraw
|
||||
bool autom; // whether 'signcolumn' is displayed in "auto:n>1"
|
||||
// configured window. "b_signcols" calculation
|
||||
// is skipped if false.
|
||||
} b_signcols;
|
||||
|
||||
Terminal *terminal; // Terminal instance associated with the buffer
|
||||
|
Reference in New Issue
Block a user