mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 14:38:32 +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
@@ -6172,20 +6172,6 @@ bool fish_like_shell(void)
|
||||
return strstr(path_tail(p_sh), "fish") != NULL;
|
||||
}
|
||||
|
||||
/// Return the number of requested sign columns, based on current
|
||||
/// buffer signs and on user configuration.
|
||||
int win_signcol_count(win_T *wp)
|
||||
{
|
||||
if (wp->w_minscwidth <= SCL_NO) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int needed_signcols = buf_signcols(wp->w_buffer, wp->w_maxscwidth);
|
||||
int ret = MAX(wp->w_minscwidth, MIN(wp->w_maxscwidth, needed_signcols));
|
||||
assert(ret <= SIGN_SHOW_MAX);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// Get window or buffer local options
|
||||
dict_T *get_winbuf_options(const int bufopt)
|
||||
FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
|
Reference in New Issue
Block a user