mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 21:48:35 +00:00
perf(column): keep track of number of lines that hold up the 'signcolumn'
Problem: The entire marktree needs to be traversed each time a sign is removed from the sentinel line. Solution: Remove sentinel line and instead keep track of the number of lines that hold up the 'signcolumn' in "max_count". Adjust this number for added/removed signs, and set it to 0 when the maximum number of signs on a line changes. Only when "max_count" is decremented to 0 due to sign removal do we need to check the entire buffer. Also replace "invalid_top" and "invalid_bot" with a map of invalid ranges, further reducing the number of lines to be checked. Also improve tree traversal when counting the number of signs. Instead of looping over the to be checked range and counting the overlap for each row, keep track of the overlap in an array and add this to the count.
This commit is contained in:

committed by
Lewis Russell

parent
e42f03264b
commit
4a34da82c1
@@ -2095,6 +2095,8 @@ const char *did_set_signcolumn(optset_T *args)
|
||||
if (check_signcolumn(win) != OK) {
|
||||
return e_invarg;
|
||||
}
|
||||
int scwidth = win->w_minscwidth <= 0 ? 0 : MIN(win->w_maxscwidth, win->w_scwidth);
|
||||
win->w_scwidth = MAX(win->w_minscwidth, scwidth);
|
||||
// When changing the 'signcolumn' to or from 'number', recompute the
|
||||
// width of the number column if 'number' or 'relativenumber' is set.
|
||||
if ((*oldval == 'n' && *(oldval + 1) == 'u') || win->w_minscwidth == SCL_NUM) {
|
||||
|
Reference in New Issue
Block a user